Multiple Properties In A Collection

Aug 10, 2010

I want to create a collection with multiple properties.

View 15 Replies


ADVERTISEMENT

.net - Collection Initializes For Read-only Collection Properties?

Jul 25, 2011

I'm trying to support Basic.NET on my framework so I'm trying to convert C# 4 code to Basic.NET 10. Microsoft is committed to "co-evolve" these two but I'm having a problem with collection initialization... I found that I can initialize a collection much like in C#:

[Code]...

View 6 Replies

See Properties Of A Generic Collection Object?

Apr 8, 2009

I have a class which extends HashSet(Of T).I am trying to evaluate some custom properties of this HashSet during execution and make decisions based on those values.

During debugging, I am pausing execution and adding a Watch on my instance of this HashSet.

The Watch only provides me with a view of the Count of the HashSet and the objects contained by the HashSet.How can I get the Watch to show me the other properties of the HashSet?

View 1 Replies

C# Accessing Properties Of An Object From A Collection Class?

Jun 10, 2009

I am moving from VB to C#. I am trying to loop through a collection class which is a collection of data classes but I can't seem to get the actual values out of the data class properties(find the correct code to do so). I have a method that loops through the collection class(Contacts) and saves each record(Contact). I am using reflection because my method will not know if it is Contacts class or a Customer class and so forth. Here is my code in VB(watered down)

Public Function SaveCollection(ByVal objCollection as Object, ByVal TableName as string, ByVal spSave as string)
Dim objClass as Object

[Code]....

The C# code keeps returning null. In my locals window I can see the proprties on the class on objClass and the value of the propery but I can seem to figure out how to access it through code. I used the DictionaryBase because that seems to closely match would I need to do. My data class(Contact) has a bunch or properties that match the field names in the database of the Contact Table. After I get the propInfo variable set I then set up my SQLParameter with the fieldname, datatype etc and then set the value to the propInfo.value.

View 5 Replies

Hide / Omit Some Properties In Binding Of A Collection?

Mar 26, 2010

My problem is similar to the one described in this article, but I'm trying to use a different grid(DevExpress.xtraGrid) and therefore the answer (if it even works) does not apply for me: Binding Collection to DataGrid without showing all columns

Briefly, I'm binding the grid to the collection of custom objects - cMessage - to grid's datasource, but I don't want all the propertieties of the cMessage to be shown in the grid. Is there any way to hide some properties from the binding, while leaving them acessible from outside (ie.leave them as public or friend)?

View 1 Replies

Collection Properties Display To List And Labels In Main Form

May 12, 2012

I'm having trouble with collections and how it works, what I have so far is classes and I have attempted to do collection but it is not working properly. I am trying to have the collection hold the classPerson,classCustomer, and classPreferredCustomer properties, and then display it to list and labels in the Main form. [Code]

View 7 Replies

Expose Methods And Properties Of User Controls Contained In A Collection?

Mar 9, 2009

at some points, I need to call the same method on those controls (ex. user presses the clear button on the big control, I want to call the clear f(x) on each of the controls)I thought to toss the controls in a collection, and then be able to handle them something like this:
nextturns out, and I should have realized, methods and properties of controls are not exposed when treated this way. The only thing that can be seen is the stuff that the base class (control, I guess) has.

View 2 Replies

Hide Or Omit Some Properties In Binding Of A Collection To Grid Control?

Mar 26, 2010

My problem is similar to the one described in this article, but I'm trying to use a different grid (DevExpress.xtraGrid) and therefore the answer (if it even works) does not apply for me: [URL]

Briefly, I'm binding the grid to the collection of custom objects - cMessage - to grid's datasource, but I don't want all the propertieties of the cMessage to be shown in the grid. Is there any way to hide some properties from the binding, while leaving them acessible from outside (ie.leave them as public or friend)?

View 2 Replies

Multiple ComboBoxes Using Same Collection For DataSource

Apr 21, 2009

I have two combo boxesthat use the same collection for their datasource. The data member and value member are also the same properties. When the form loads, and I select an item in one of the combo boxes, the same item is then selected in the other combo box. I want the combo boxes to work separately. Do I need to have two different collections, even though they would have the same data in them?

cboInboardKnife.DataSource = cKnives
cboInboardKnife.DisplayMember =
"Name"
cboInboardKnife.ValueMember =
"ToolID"
cboOutboardKnife.DataSource = cKnives
cboOutboardKnife.DisplayMember =
"Name"
cboOutboardKnife.ValueMember =
"ToolID"

View 1 Replies

Wpf - Add Multiple Classes To An Observable Collection?

Jan 30, 2012

I'm still teaching myself how to bind and use observable collection. One problem that I'm a little confused on is binding multiple classes/observable collection to one page. In other words, if I have a PersonName class and a AnimalName class, I have to create two separate observalbe collections for each? How would I set the datacontext when a page only allows one?

[code]...

Now If I add another class, how would I combine the two on the binding part and collection part.

View 2 Replies

Wpf - Multiple Views Of Observable Collection?

Mar 13, 2012

I've been working on this problem for a while and I'm clearly missing something...I create, populate and bind an observable collection like so:

Dim _ObservableWEI As New ObservableWEI
...
_ObservableWEI.Add(New WEI() With {.WEInum = 1, .WEIvalue = 1})[code].....

The problem is the filter effects the contents of both listboxes. I guess I need a specific instance of the collection to apply the filter too or something

View 1 Replies

Filtering A Collection With Linq And Multiple Criteria?

Jun 7, 2012

On my view there is a datatable holding a collection of ServerRow and 4 textboxes (Hostname, OS, Location, Zone). When the user types into any of the 4 boxes I want to immediately filter this list. I have this code setup and ready to go that on the set method of each textbox property I call the filter method.

Now onto the problem: if I have 4 criteria that means I have 2 to the power of 4 different scenarios. What I would like to do is write a linq statement with all of these scenarios dealt with such that if any of the properties are NullOrEmpty they will not be used in the Where clause and on the flip side if there is a value the corresponding field will be searched with a Contains.

Example

AvailableCis = New ObservableCollection(Of ServerRow)
(_CiData.Where(Function(ci) ci.OS.ToUpper
.Equals(_selectedOS.ToUpper) AndAlso
ci.HostName.ToUpper.Contains(_ciNameFilterText.ToUpper))
.OrderBy(Function(a) a.CiName))

This example shows how it works with 2 criteria and both of those criteria are set.

View 1 Replies

Looping A Collection Into Multiple New Filenames - How To Speed Up

Apr 6, 2010

i have the following snippet of

For Each tempstring In SourceDataCollection
LineToFieldsTemp = Split(tempstring, ",")
LineStringWithoutFirstEntry = "" 'reset the linestring
For i = 1 To UBound(LineToFieldsTemp)

[code]....

essentially what i'm doing is to read through each item in a collection of comma separated variable strings. the first variable in each string is appended to a master filename and becomes the NEW filename to which the entire string will be appended. this is a way to split a CSV file into multiple files using the first variable in that string.

the trouble is that this is doing a LOT of writes to potentially a LOT of files, the IO is taking forever. is there a way to buffer this data until the end, then write it to a disk? be aware, the filenames and total number of files to be created is UNKNOWN at the begining of the loop. it just creates a new file each time a unique first column ID is discovered.

View 13 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

Set Multiple Textbox Properties?

Feb 12, 2012

I'm using VB2010 express and I want to set up my form to have all 22 textbox's start in read only so that my users cannot change the contents accidentally but have a button to enable the textbox's so they can.I know that i can set the properties for each textbox from true to false and back for each textbox but I was wondering if there is group way of doing this or do I need to do each one separately .

View 17 Replies

.net - Bind Multiple Properties On The Same WPF Control?

Jan 12, 2012

I am able to bind my datasource to the textblock for the display text. However I would like to set the Fontweight to bold if the value of the checkbox foo is checked. I'm trying to use IMultiValueConverter to accomplish this, but have had no luck so far.

<CheckBox Name="foo"/>
<TextBlock Name="bar" Text="{Binding Path=Name}">
<TextBlock.FontWeight>

[Code]....

View 2 Replies

Change The Properties Of Multiple Controls Using For - Next?

Sep 29, 2010

In my project, I am trying to change the visible property of my various pictureboxes using a for - next statement. My aim is to get the value of my numericupdown1 control and use this number to make the pictureboxes visible. For example, if this number is 8, the picturebox1, picturebox2, .......8 will be visible. Here is the code I wrote:

[Code]...

View 27 Replies

How To Call Multiple Objects With Same Properties

Apr 15, 2011

How can I call multiple objects? Example..
nameTextbox.Enabled
addressTextbox.Enabled
ContactTextbox.Enabled
How can I call this objects with same properties...

So rather than typing them all with =True or False...
I just have to type a variable = True or false...
And where will I type the code.

View 9 Replies

LINQ Group By With Multiple Properties?

Jun 10, 2011

I spent a lot of time on this problem. I am able to do simple Group By LINQ queries (on one property) but for multiple fields I'm a little stuck... Here is a LINQPad sample of what I want to do :

dim lFinal={new with {.Year=2010, .Month=6, .Value1=0, .Value2=0},
new with {.Year=2010, .Month=6, .Value1=2, .Value2=1},
new with {.Year=2010, .Month=7, .Value1=3, .Value2=4},

[Code]....

View 3 Replies

Numbers-Only Properties On Multiple Textboxes?

Feb 28, 2011

I have a problem whereby I have 10 text boxes and I don't like to use the same code for each and every text box that allows users to input only numbers, which could be very long and messy coding.

Is there any shortcut that I can set all (not just one) text boxes to allowing user to input only numbers?

View 6 Replies

Sorting A Class Of Multiple Properties?

Oct 13, 2011

I have created a Class, basically like this:

Public Class Person
Implements IEquatable(Of Person)
Public Sub New(ByVal Name As String, Optional ByVal Like As Boolean = True)
Me.Name = Name

[Code]...

View 4 Replies

IDE :: Modify Properties On Multiple Same Type Controls?

Oct 6, 2010

i need to do something as the old scholl on vb6, create a control array, i need to put 50 listviews controls and when the form is initialized start asigning properties since i will drag items to each one of those grids, im goin to make a dragdrop event to handle all the 50 controls, dont like the idea of adding handles c1, c2,cn, c50 but whatever, is there soemthing easy to create a routine to change properties and add columns to each one control dinamically?

sample

for x=0 to 50
control(x).property = true or ""
next

View 2 Replies

Populating A Combobox With Multiple Properties From Object?

Apr 30, 2009

Using vb.net (vs2005), how do I populate a combo box with multiple property values from an object? Right now I'm iterating a collection of objects and adding the name property of each object to the combo box. I'd like to add multiple properties from the object to the list. For now, I'd be happy if they appeared comma separated in the list.

View 3 Replies

Sum The Properties Of Two Members Of A Collection Without Doing It Property By Property?

Aug 8, 2011

I've reviewed the links that were offered and don't find an answer. Neither has a lot of searching helped, probably because I can't think of a reasonably short way to ask the question. I hope that I've at least found the proper forum and category.

In my VB 2010 code, I've defined a structure that has about 30 elements. I want to sum the properties (they are all singles) of two members of the corresponding collection. I understand that I can do something like:

member1.property1=member2.property1+member 3.property1 for the entire set of properties of member2 and member3 to produce a completely defined member1 What I wonder is whether or not there is a way that uses fewer lines of code - I know that I can't do:member1=member2+member3, for example.

View 7 Replies

VS 2010 Make Class Properties With Multiple Options?

May 20, 2011

I am just learning about making classes and need to make one with 2 properties.Below is the beginning of a class for ingredients in a coffee machine.But I want sugar and water to also hold name (string) ='sugar' and number(integer) = 4 so its like thisIngredients.coffee.name or ingredients.coffee.number[code]

View 3 Replies

Have Multiple Selectable Options Property Listed In Properties Window?

Feb 25, 2010

I have a UserControl with a property called "Type". This can have any combination of three values, say

View 1 Replies

Sync Locks - Manage Access To A Collection Object From Multiple Threads - Add, Update, Remove, Clear

Oct 20, 2009

I am considering a piece of code that will manage access to a collection object from multiple threads - add, update, remove, clear. OK ... so I have put a sync lock within each method, but what is not clear from the MS documentation is exactly how the sync lock is behaving. Is it locking the piece of code it wraps? Or is it locking the object? And if it is locking the object a private static object should lock out any code locked on the object within all instances of the object? i.e. if an add operation is underway, an update, delete or clear will wait for the lock to be released.

Finally, if I have multiple threads contending for the sync lock, how is the release managed? First come, first serve? random (from my p.o.v)? Is there a chance that two separate threads could blunder into 'locked' code simulataneously?

View 2 Replies

.net - Multiple "= New" With The Same Variable - Does Garbage Collection Dispose

Jul 30, 2009

Dim x as whatever
Try
x = new whatever(1)
something is done with x

[code]....

What happens to x = whatever(1)Does garbage collection find the pointer to the first new and destroy it or what?

View 2 Replies

.net - Storing Subcollections (filtered Versions Of The Main Collection) Inside The Collection As Cache?

Jan 15, 2010

Is it good practice to store sub-collections of item X inside a parent collection of item X for caching 'filter-queries' which are performed on the parent collection? (They won't be used together (as in color AND type).) Or is it also ok to just Loop over the collection and return the correct entities in a temporary collection?

[Code]...

View 1 Replies

C# - Edit List Collection : Error Note Collection Was Modified - Enumeration Operation May Not Execute?

Sep 7, 2011

I have the following classes:

Product, Service and OrderItem

Product and Service must inherit OrderItem. So basically I want to store OrderItem object in my shopping cart and these object are store in a list.

Public MustInherit Class OrderItem
Private m_enuItemType As TypeOfItem = TypeOfItem.None
Private m_strUserID As Integer[code].....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved