List(of T) Custom Sorts In VB

Oct 13, 2011

Im converting a winforms application and it has gone smoothly except for trying to get custom sorts for generic lists working.

VS 2010 ASP.net 4.0

I have my classes in App_code but it fails to work like the winforms version.

Dim ReturnList as List(of Quotedata)
ReturnList.Sort(New SortQuoteDateAscending)
> Unable to cast object of type 'SortQuoteDateAscending' to type 'System.Collections.Generic.IComparer`1[Quotedata]

Is there a gotcha with asp.net implemenation of custom sorts in asp.net 4.0 or am I missing something.

Public Class Quotedata
Private m_quotedate As Date
Public Property QuoteDate() As Date

[Code]....

View 3 Replies


ADVERTISEMENT

Multiple Sorts On List<Of T>?

Apr 1, 2011

I am using VB.NET and .NET framework 3.0I am currently sorting a list like this: lstPeople.Sort(Function(p1, p2) p1.LName.CompareTo(p2.LName))However, now I want to sort by FName as well after the LName. So it sorts first by last name and then by first name.

View 3 Replies

Pass Generic List To A Function That Has A Custom Defined List

Apr 7, 2011

it seems always at this time I cant figure out how to do something maybe it has something to do with lunchtime.

Im having trouble using a method that is defined by an outside company

This is a link to their integration guide:

[URL]

This is their documentation for the class Im trying to use

OrderQueryWebService Class

This class is for SID in particular and is made for use with the notification methods. This is for the Order Query Web Service specifically, allowing clients to return the status of transactions for their merchant, whenever they want to.

Methods
/ <summary>
/ Pass through the variables required and receive a list of Transaction
objects showing transaction status

[Code].....

The MerchantCode, the MerchantUsername, the MerchantPassword are all good the List is a custom type called SetComHash.Transaction

Everytime I try adding a string to the list such as the transactionNumber and some other values it gives me a type error:

"Value of type string cannot be converted to 'SetcomHash.Transaction'

View 13 Replies

VS 2010 Custom Type Array / List With Adding Items And Specifying Custom Type Variable

Jun 21, 2011

I recently downloaded VB 2010 Express so i am quite new to the language, but i have worked with dark basic, which seems to b very similar.Anyway, my problem is that i cannot seem to correctly set out my array of a custom type/class. i am trying to create two arrays, one of available entities and another of selected entities of which the user selects the entities to be dealt with in irrelevant ways. i have creates a button (called test) which adds some entities to the available list and all the entities come back the same value but they shouldnt be as you'll c in the code. i have run the step into command a found that "available.item(#).Name = " will change all of the entity's names.As of current i am working with lists as the array kept asking for a 'new' statement but i couldnt figure out where to put it.[code]

View 7 Replies

Vb.net - Convert From Custom List To List Of String

Mar 25, 2010

I have the following code:

[code]...

The intention is to convert an IList of custom objects to a string equivalent comprising each element in the Ilist. Unfortunately I can't seem to find a way to get the underlying data of the custom object, and of course as in the above example, using object simply gives me a string of types definitions, rather than access to the underlying data.

View 2 Replies

Get Custom Properties For A Custom Control Into The Visual Studio Properties List?

Nov 25, 2009

What I've done is create a User Control Library (Project) and I've added a single User Control to that project. The control contains a single FlowLayoutPanel, and I created a Property on the control itself to pass the FlowDirection from the Control to its FlowLayoutPanel child.

Build, reference, component appears in the Toolbox and everything works fine, but the property on the control does not appear in the Properties window when I go to edit it at design time.

View 6 Replies

.net - IComparable - Call Different Sorts?

Aug 17, 2010

I have a DTO that I am using to process transactions. To ensure that it is processing in the correct order, I am using iComparable and sorting the List(of T) of the DTO. That works great. However I just got another requirement that the customer wants the output in a different order... is there a way to allow me to have two different sorts for the same object, or do I need to copy the current class, save the output as a new List of that type and sort using the new way for that object?

View 2 Replies

Multithreading - Create Custom Objects/list Of Custom Objects In .NET?

Jan 24, 2010

I need two seperate lists, which every item is Integer, String, Bitmap - and one which every item is Integer, String String. However I don't know how to do this, or even where to look - I've googled for custom objects and custom object lists. What I'm trying to do is this.Custom Object1 is Integer, String, Bitmap Custom Object2 is Integer, String, String

In one thread I'll be adding items to List1(Of Object1), and processing them, and adding the results to List2(Of Object2), however I need to be able from other threads to look at the list and say only give me the items where Integer = (my thread ID), is this possible? Any help, or even links to information that would be relevant to this request would be helpful?

View 2 Replies

Dataset Merging Sorts Records Incorrectly?

Feb 4, 2011

I have a temp dataset (ds) that I load with data from a filtered dataset. I run this in a loop essentially populating the temp dataset with select records from the main dataset. I then merge the temp dataset back to the main dataset (dsSpecifics). The issue I am running into is that the records are loaded into the temp dataset in the way they were merged. record 1 is at row 0, record 2 is at row 1 and so on. When I merge the ds back to dsSpecifics, they load out of order but in a predictable way. Here is a snipit of the code:

myAircraft.Reset()
While myAircraft.MoveNext()
Me.TblAircraftSpecificTableAdapter.FillBy(Me.DsSpecifics.tblAircraftSpecific, CInt(myAircraft.Key.ToString))

[Code].....

It seems that after the final merge, the merge starts with the last record of ds and and then rolls over to record position 0.

View 1 Replies

Develop An Application Which Sorts Text Files?

Nov 6, 2009

I need a little guidance here. What I am needing to do is develop an application which sorts text files, approximately 10 at a time.It would look something like this. (Using VBA 2008)The code I am having trouble with, is I want to be able to "load" 10 of these txt reports.I want the Sort button to trigger the application to run through each text file looking for specific keywords.

And finally, when all is said and done, I want it to export a new text file with the keywords listed that it found.I am just breaking into this and am super excited with how much I have learned so far!

View 2 Replies

Develop A Converter Of Sorts - Math.ceiling Is Not Working?

Apr 26, 2012

I'm trying to develop a converter of sorts, and I need it to always round up, however, math.ceiling is not working like I would like. The converter I'm trying to develop is a Canadian MMAR Calculator.Here is my code.

Public Class Form1
Private Property growtype As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click[cod

For some reason, when the variable < .5 it rounds down, and when the variable is > .5 it rounds up, I thought math.ceiling always rounded to the highest nearest whole.The issue comes at growtype 2 and 3, this equation "(num1 * 365) / (250 * 1) * 1.3" where num1 = 18 returns 34.164, I want this to round up to 35.

View 3 Replies

Build An Application That Will Serve As A Very Large Checklist Of Sorts?

Apr 21, 2009

I am trying to build an application using vb.net that will serve as a very large checklist of sorts. and i'm not exactly sure of the best way to do this. I considered using a database but i would need it to be self contained without having to rely on a server or internet connection

View 4 Replies

Retain Row Attributes In A DataGridView When User Sorts By A Column?

Oct 20, 2010

I have a DataGridView, bound to a dataset. All the columns are sortable (.ColumnSortMode.Automatic). The user may change data in certain columns, although not the first ("key") column. When data gets changed on a row, I change the backcolor for that row (to show it as dirty). At some point, the user will do something with all of these changes.

My problem is that I still want the user to be able to resort the data by any of those columns. When it's sorted, though, I lose the backcolors that I changed. I do know which rows are dirty, this is just a cosmetic issue. Isn't there a way to retain those backcolors, or any other such row attribute?

View 6 Replies

Created A Database Which Only Have One Table Where It Stores All Sorts Of Keywords According To Categories

Aug 9, 2011

I'm using MySQL 5.5 database. I have created a database which only have one table where it stores all sorts of keywords according to categories.

The users key in sentences in the textbox and then I'm suppose to classify the sentences into the category based on the keywords in the database.

How do I loop through the database to compare the strings in the textbox to the keywords in the db?

View 2 Replies

VS 2010 - Array SubString (of Sorts) / Making A Class That Represents A File?

Feb 24, 2011

Im making a class that represents a file. Im making a sub that reads data from one byte array into many properties. Now i need something that returns a byte array but only the first 4. Let me demonstrate because i can't think of a logical way of explaining. "something".substring(0,3) That would return a string containing "som" i need a function like that for a byte array


[code]...

Is there an existing function for this type of thing ? i've looked but didn't see anything that I understood.

View 2 Replies

List Of New Custom Object?

Sep 2, 2010

I created a simple (for now) custom object:

VB
Public Class Form1
Dim AllPartFiles As List(Of Part)

[code]....

As I search a folder for files, it returns FilePath as a string for each file in the folder, then assigns a new Part.FullFilePath to the current returned FilePath, then add the Part to AllPartFiles list. So I can retrieve each Part from AllPartFiles later. But everything I try doesnt work.I know below is wrong, but might show what Im trying to do:

VB
Dim Files() As String
Files = System.IO.Directory.GetFiles(RootFolder, "*.ipt")
Dim k As String

[code]....

Create a New Part, change its values, and then add it to AllPartFiles list for later, then repeat?

View 12 Replies

Searching The Custom List?

Feb 12, 2010

I want to use a System.Collections.Generic.List<Of T> and store custom objects in the list. I then want to filter the list by my own custom defined criteria and return a System.Collections.Generic.List<Of T> of all the objects in the list matching my search criteria. For searching in Java, you would create an object that implements the comparator interface. The object would then be passed as an argument to the list's sort method. Is there an equivalent VB way to do this BUT when searching for items in the list?I have looked at using delegate functions, but these pass EVERY item of the collection into the function, which is not efficient in any way.

View 12 Replies

VS 2010 Using .Contains On A List(of Custom)?

Mar 31, 2012

I have made a custom structure which I have in a list.Dim AllUsers As New List(of mUsers)Structure mUsers Dim mName As String Dim mMadeDate As Date Dim mActivated As BooleanEnd Structure I have populated the list, but now I would like to be able to search it, and to check if something exists inside of it. For example, I would like to check if.If AllUsers.mName.Contains("John Doe") = True Then MsgBox "User John Doe Exists!"

I know if this was simply a List (of String) then .Contains("John Doe") would work. But I cannot figure out how to have it look through the contents of that custom type in the list(of.

View 3 Replies

Create A Console Application That Lets A User Enter 20 Names And Then It Sorts Them Out Alphabetically In Order?

Mar 25, 2012

I need to create a console application that lets a user enter 20 names and then it sorts them out alphabetically in order and then displays them.

Module Module1
Sub Main()
Const names As Integer = 20
Dim index As Integer

[code]....

View 2 Replies

Add Custom Class To A Generic List?

May 10, 2010

I created two classes. One class is StudentClass and the other is HomeroomClass. The HomeroomClass contains a readonly property as a generic list of the StudentClass. [code]...

View 6 Replies

Custom Chart Types To List Box?

Nov 14, 2009

Is it possible to add Excel Custom Chart Type names to a list box at run time? That is, Microsoft.Office.Interop.Excel.Chart.XLChartType values to a list box?

View 1 Replies

List(of Object) With Custom Add Action?

Dec 5, 2011

Looking to have a list(Of object) where i can make my own Add method, so i can do some stuff to an item when added

Is that possible at all, been looking at the net and haven't found anything.

View 5 Replies

Accessing Objects From Within A Custom Object List

Mar 3, 2009

OK - for starters - I'm not even sure that the title of this thread accurately describes what I want to do - but I had trouble verbalizing it. So I will give this a try: In my application, I have a custom object, call it myObject. In addition, I have another custom object called myObjectList which is basically a List(Of myObject).

Up until this point, all of the functions that I have been working with in my BLL and DAL have been shared - I haven't needed a specific instance of my object thus far. I currently need to write a function that finds a particular myObject within myObjectList and returns to me myObject. I know that the List(Of T) has a find method, but from what I have read so far - I don't think it is what I want (doesn't it return true or false? -and also, do I need an existing object to pass to it to see if it is in the list?)

[Code]...

View 5 Replies

Comments - Custom TODO: List On An Interface

May 21, 2010

How do I add my own todo and comments list to appear on Interfaces? I want it to pop up like IDisposable does:

[Code]...

View 1 Replies

Create Custom MessageBox With List Of Options?

Oct 15, 2009

I want to create my own custom MessageBox.
The default message box from VB contains a few options (as a parameter) like:
MessageBoxButtons.OK
MessageBoxButtons.RetryCancel
MessageBoxButtons.YesNo
MessageBoxButtons.OKCancel
etc...
How can I create a sub that also has a list of options the user can choose from??

View 3 Replies

Custom Control - Specifying Items To Be Added To List

Sep 30, 2009

I've created a custom control that I insert into my window with the following code
Code:
<controls:ListExpander Text="Class Diagrams"></controls:ListExpander>
The control in question contains several subcontrols, among others, a list. How can create the setup, so I can specify items that should be added to the list?

Code:
<controls:ListExpander Text="Class Diagrams">
<SomeItem>data<SomeItem>
<SomeItem>data<SomeItem>
<SomeItem>data<SomeItem>
<SomeItem>data<SomeItem>
</controls:ListExpander>

In which case the SomeItem objects should be added to the list in the ListExpander:
Code:
<ListBox Name="lstItems" Background="LightGray">
<ListBox.Items>
// Items should go here
</ListBox.Items>
</ListBox>
I'm quite new to WPF, but I suppose it's something along the lines of creating a dependency collection on ListExpander that takes object of the type SomeItem? I simply want to be able to give the control a few arguments which it can translate into items in the listbox contained within the the control.

View 4 Replies

Custom List / DGV For Auto-wrapping Columns

Dec 19, 2009

I attached a screenshot of my IRIS program and am wanting to implement a new feature, but I'm not sure how to do it. On the left hand side, you can see I have a bound datagridview control that displays a device name and an IP Address from a table in a database.What I want to do is have the option to launch a new form that has ALL the devices visible (including their state: green or red) and based on the size of the form, be able to auto-wrap to a new column.[code]So basically, instead of being able to only see the devices in the DGV on the left as it is scanning, I want to be able to see ALL of the devices in multiple columns in a new form. I looked on codeproject for a custom control to do this, but didn't really find anything.

View 5 Replies

Possible To Use Generics To Populate List With Custom Classes?

Jul 10, 2009

I have several different lists I want to call. They all have the same format for the class:
id, value, description, order.
Instead of creating a bunch a classes to return the all of the many lists, I wanted to use generics and just tell it what kind of list to return. However, I can not figure out how to populate the classes.

Here are 2 examples of function in my calling code. This should indicate the type of list and the stored proc used to get the data:
Public Function getTheEyeColors()
Dim glEyeColors As New GenericList
Return glEyeColors.GetALList(Of EyeColor)("GetAllEyeColors")
End Function
[Code] .....

View 4 Replies

Search A List(of T) Where T Is A Custom Data Class?

Oct 17, 2011

I think my question is a little more complicated than I can fit in the title. Say I have a data class for contacts:

Public Class Contact
Public Property Name As String
Public Property Phone As String

[Code].....

I have a List(Of Contact) object with several different contacts. How would I search the List for the contents of one of the properties and return the resulting Contact object?

View 1 Replies

VS 2010 Custom Query Against List<string>

Aug 15, 2011

I have a List<string> that contains paths, such as:

[Code]...

Given a given root, such as Root, I would like to "query" this list to return only the first level values, such as:

[Code]...

View 2 Replies







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