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
ADVERTISEMENT
Jan 25, 2012
I'm trying to figure out a way to sort the entries of a listbox... but in a different way instead of the obvious one (sorted property). First of all, I need to explain how the items are populated at first:
[Code]...
View 19 Replies
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
Mar 12, 2012
I'm having my program sort an excel sheet by a few columns. However, it is only sorting by the first column not the rest that I specify.ere is my sort code below:
myRange.Sort(Key1:=myRange.Range("A:A"), Order1:=XlSortOrder.xlAscending, Key2:=myRange.Range("G:G"), Order2:=XlSortOrder.xlAscending, Header:=XlYesNoGuess.xlYes, Orientation:=XlSortOrientation.xlSortColumns)
[code]...
View 1 Replies
Oct 3, 2011
I have a List of FileInfo objects that I want to sort by creation date & file size. Is there a way to do that?
View 5 Replies
Aug 30, 2011
I have a group of objects stored in an arraylist. These custom type objects have a number of properties from their underlying class . I want to use one of the properties to sort the array. I cannot determine which Array.Sort method to use.
I want to sort based on an integer property. Virtually every example I can find involves sorting strings.
So, assume the Objects have the following properties.
Obj.name as string
Obj.ID as integer
Obj.Alive as boolean
The objects are kept in an arraylist called FriendsOfMine.
I want to be able to order the list by Obj.ID, both ascending and descending in value.
View 12 Replies
Dec 29, 2010
This is another one of my "I think it's not possible but I need confirmation" questions.I have a base class for a bunch of child classes. Right now, this base class has a few common properties the children use, like Name. The base is an abstract class (MustInherit)Technically, this means that everytime a child class is instantiated, it lugs around, in memory, its own copy of Name. The thing is, Name is going to be a fixed value for all instances of a given child. I.e., Child1.Name will return "child_object1", and Child2.Name will return "child_object2".
View 1 Replies
Aug 19, 2009
I have a class in which some of the fields are also classes.I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"But the code compiles fine.
dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error
How can i fix this ?
View 6 Replies
Aug 19, 2009
I have a class in which some of the fields are also classes.
I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"
But the code compiles fine.
dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error
View 4 Replies
Jun 25, 2011
I have a list (i.e. Dim nList as new List(of className)). Each class has a property named zIndex (i.e. className.zIndex). Is it possible to sort the elements of the list by the zIndex variable in all of the elements of the list?
View 4 Replies
Apr 1, 2008
I plan to do a multiple sorting in crystal report programmatically... but i encounter some error... prehaps someone can guide me through
Dim crfd4sort As FieldDefinition
strSort = "ITEMNO_PRT, INSNO_PRT, VALUE_PRT, DATE_PRT"
[CODE]...
View 3 Replies
Jun 9, 2009
I'm trying to sort multple colums in the DataGridView which is unbound. I would prefer to sort by using a DataTable/DataView but for some reason another developer in my team experienced other problems relating to sorting so he abandoned using the DataTable to fill the grid :(
Here is the senario: I want the user to be able to choose which columns they want sort on. The way I envisaged was to show a form with a listbox, a grid and 3 buttons (Add to sort, Remove from sort and Apply Sort).
The list box would be populated from the parent form grid column headings.
The grid will show the columns and sort direction.
Button 1 would add the selected item of the list box to the grid.
Button 2 would remove from the grid the selected row.
Button 3 would Apply the Sort in the order of the grid and the columns SortDirection.
Now I looked at How to: Customize Sorting in the Windows Forms DataGridView Control using the IComparer [URL]
how I can use the IComparer to sort on multiple columns that a user has specified or another way to sort on multiple columns using unbound data.
View 3 Replies
Sep 26, 2011
I've got three arraylists of strings, and the "091: " part of the string is not part in the arraylist, thats added when I display them in the listboxes. So basically, how can I sort a list, and make sure that item nr 98 in english, still equals nr 98 in japanese and kanji?
View 11 Replies
Oct 7, 2009
I have a two-column ListView linked to a Datapager. The ListView lists all files of a particular type in a particular directory, so the data source is an ArrayList of type FileInfo. Consequently, I had to create a Comparer class to use in the ArrayList.Sort method.
[Code]...
View 3 Replies
Apr 30, 2010
I'm using the following code to sort a List(of Class) using LINQ. It works fine, but I'm wondering if there is a better way to do it. I'm basically taking one list, applying LINQ to it, then using the result to create a second list in the sorted order. Can I do this without creating a second list? Here is my sample
' KeyMatch is my Class Variable
' mMatchList is the Unsorted List
'
[code].....
View 3 Replies
Nov 2, 2009
I need to sort a list (of person) to person.Age within person.Department. f I user personlist.sort with a comparer for Age and then sort again with a comparer for Department, the sequence of age is destroyed.
View 1 Replies
Apr 7, 2011
I have a ListView (GridView) that I want to sort by 2 columns, so if 2+ items have the same value in Column 1, it sorts by Column 2. Pretty easy. But empty strings show up at the top when sorting A-Z. I'd like to move them to the bottom. I made a comparer (IComparer) that takes care of this, but I'm not sure how to use it.[code]...
View 1 Replies
Oct 8, 2009
I have the following in my main form
Class MainWindow
Public TableDetails As New List(Of TableDetailsContainer(Of TableXDetails))
Public Sub ArrangeByID()
'''STUCK HERE''''
[code].....
What I basically want to achieve is to sort TableDetails(i) items by their "ID", but I have absolutely no idea how to go about it. Could anyone please give me pointers?Also, I actually want to move the columns within TableDetails(i) around, manually. But I'm not too sure how to do that.
View 6 Replies
Feb 17, 2011
I'm using a Listview in VirtualMode, so I can 'add' a lot of files almost instantly. A Listview in VirtualMode does not allow sorting, so I need to sort the data myself. The data is stored as a List of Structure (it's faster to load than a List of ListViewItem). The code below works fine, but I need to sort based on multiple variables in the Structure. Code:
View 2 Replies
Nov 10, 2010
I wrote a function that copies the properties of one class to another so make a copy of an object.So something like
MyObject myObject = myOtherObject.MyCustomCopy(myObject)
where myObject and myOtherObject are of the same type. I do it by bascually doing
myObject.prop1 = myOtherObject.prop1
[code]....
I am pretty sure in the past I used a .NET object that automaticaly did this, by reflection I guess, but can't remember it ... or an I imagining that such a method exists?
View 5 Replies
May 20, 2011
I've followed examples here and here to create a generic sort with memberexpressions, but how I'm supposed to add a "ThenBy" clause, or combine multiple columns for sorting in the methodcallexpression. Ideally, the ThenBy should go before skip, but it can't because it can't see the orderby clause that I made with the methodcallexpression. GridSortExpression is a Telerik class - it just describes which column and direction the query should be sorted.
Here is what I have right now:
Dim exp As Expressions.Expression(Of Func(Of Product_Catalog, Boolean)) = PredicateBuilder.True(Of Product_Catalog)()
exp = exp.And(Function(e) e.Chapter_Price > 30)
Dim sortExpression As New List(Of GridSortExpression)({New GridSortExpression() With {.SortOrder = GridSortOrder.Descending, .FieldName = "Id"}})
[Code] .....
View 1 Replies
Feb 10, 2011
I have created a class for a Sports Facility. A facility has a Name, Status, Notes, etc as members of the class. This works well, I can create a new instance of an exisitng Sports Facility from the database, create a new instance, etc. All working well.What I am stuck on is accessing a list of Sports Facilities. I know I can create a new list by doing
Dim List As New List(Of Facility)
For Each fRow As DataRow In ds.Tables("Facilities").Rows
List.Add(New Facility(fRow.Item("FacilityID"))
Next
View 4 Replies
Jan 22, 2010
as you might guess from the variable names I'm making a game (but this problem isn't game related!) which involves multiple "bullets" moving along straight trajectories. This is my attempt at changing my code for firing one bullet into one for firing many bullets at once. It works perfectly except for one thing.The class I made (BulletClass) to contain all the things needed to move the bullet isn't setting all of its properties correctly. I apologise for the walls of code however I wasn't entirely sure whether I should chop bits out. I wanted to colour code my code so that you could scroll through and see the subs where things have gone wrong, but apparently I can't even code a new thread. Let alone a video game. Instead I'll just list them, you can search for them if you like or just scroll through at your leisure.
[Code]...
In a nutshell: the properties TargetPosY, TargetPosX, ShipPosX and ShipPoseY are not working properly. As a result the calculations involving them are skewed and the bullets always travel directly downward.
View 2 Replies
Feb 7, 2009
I've got a Dictionary collection of a certain class with dozens of string properties.i'd like to create a datatable from this info and map these properties into Datatable columns, and for each member of the dictionary maps it to a row...
i could type out column names based on the class properties, but thats a bit specific and hard coded.
What I want to do is something like
Dim mytable as datatable For each string_property as property of myclass Dim column as new datacolumn(string_property.name) 'column add to table etc Next I'm unfamiliar with how to do this, maybe the Reflection classes are useful - perhaps the guru's can point out an efficient solution?
View 2 Replies
Jun 9, 2010
Is there a way to clear all the properties in a class, because i have a class where all my properties were stored, can i clear all those in just a short code?
View 6 Replies
Mar 8, 2012
I've tried searching... a lot for the answer, but as I'm not too sure what exactly I'm trying to do I can't seem to find anything. I'm trying to write a dll in order to handle errors thrown from a vb.net app. In the dll I need several forms (I'm not totally sure if they can have forms - I'm a bit of a newbie when it comes to dll's) for which the user can type in their message about the error and submit it.
[Code]...
View 1 Replies
Apr 17, 2010
I have dynamic class with varied numbers of property. At one time I need to save all data from this class. So, to do the For/Next or Do/Loop, I need to know, how many properties in class for now? Is it possible to findout the property numbers and after - property names list?
For example. I have a class INI, were was .Path as preexisted property. Then the few properties has been added and INI start consist of .Path, .Size, .Color and something else.
I dont want to keep in mind all properties has been added. All I want to get some simple loop to read all properties names and values to dump it to the file. Some sort of this[code]...
View 3 Replies
Feb 28, 2009
I am filling a form with values from a class, which is working fine. But now I want to take the changed values in the text box and modify the class. For some reason I have not been able to get the syntax.
View 6 Replies
Nov 20, 2010
I have created a class named CustomerType - CustomerTyp, which includes 4 properties - ID, Name, Number, Selected. I need to make a code, which determines how many properties has the class.
View 2 Replies
Mar 19, 2012
How can I get all the properties of a class that implement a specific base class or interface? I have a properties class that contains several other property classes. Some, not all, of these classes implement an interface. I would like to know if it's possible to iterate over all properties of parent class for child-classes that implement the target interface. It sounds like a job for reflection? I'm just not sure how. Can it be done via the "PropertyInfo" object?
View 1 Replies