.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


ADVERTISEMENT

IComparable With IComparable(of T) Recommended?

Jan 27, 2010

IComparable(Of T) does not inherit from IComparable. after checking the documentation it doesn't say that its recommended or not recommended to implement IComparable as well if we have IComparable(Of T). so is it ok to implement IComparable(Of T) without implementing IComparable (and making it sync with IComparable(Of T)?

View 2 Replies

Use A Structure To Implement IComparable?

Jan 15, 2009

This question spawned from an example jmc gave to someone on how to use a structure to implement IComparable... now I always thought that structures could only be used to store basic things like this:

vb.net
Private Structure PersonStruct
Dim FirstName As String
Dim Surname As String
Dim HouseNumber As Integer
End Structure

but it turns out you can define functions, subs, delegates and even events, all from within a structure. So that made me think... whats the real differences between a Structure and a Class? JMC highlighted one difference and that was not being able to create a new instance of a structure and pass in arguments to be initialized but apart from the lack of constructors is there really much difference? I assume there must be as Classes seem to get used a hell of a lot more than structures but I dont really understand why there is a need for both of them if they are so similar... I mean if classes have a few more features then why ever use a structure? Are they more 'lightweight' or something?

View 3 Replies

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

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

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

Way To Implement IComparable (Of T) Or IComparer(Of T) If Class Is Not A Generic Class

Feb 19, 2010

I am working on a general helper class to sort ListView SubItems. I wrote a base class that has much of the code I need. It includes a MustOverride for the Compare method so that the various inherited classes can implment their own comparisons based upon their type. For the value types, I end up with very similar code such as the following, where x and y are ListViewItems: Public Overloads Overrides Function Compare(ByVal x As Object, ByVal y As Object, ByVal sortColumnIndex As Integer, ByVal sortOrder As System.Windows.Forms.SortOrder) As Integer [code]

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

Unable To Cast Type 'System.String' To Type 'System.IComparable'

Apr 4, 2012

[code]Unable to cast the type 'System.String' to type 'System.IComparable'. LINQ to Entities only supports casting Entity Data Model primitive types. I'm in a DDD-layered application, so the parameter should stay the same as the called method is an overridden interface (eg. if i change this, i have to do this for 200 times or so, because it's in VB.Net and not in C# (= 1 change) )

View 1 Replies

TCP Client/Server App That Sorts Out Text That Is Recieved From Server?

Aug 18, 2011

I'm currently "trying" to make an app that gets a certain text from the client and sends it to a server and the server sorts it out every text that he gets from the client into a different label every time he gets a text from a client. For example :

Client1 sends certain text to Server and server puts it in label1.text
Client2 Sends different text to Server and server puts it in label2.text
Client3 sends different text than 1 and 2 to Server and server puts it in label3.text
and so on.

View 3 Replies

.net - Cannot Call Stored Procedure From Code Which Works On Direct Call To Database

May 17, 2011

I connected to the Informix server using RazorSQL, created a stored procedure and tested it, getting the expected answer, so the procedure exists in the database in some form.

I then run the following code:

If ConnectToInformix() Then
Dim cmd As New IfxCommand("dc_routeHasOutstandingQuantity", conn)
cmd.CommandType = CommandType.StoredProcedure

[Code]....

This error does not occur when calling the stored procedure from a live SQL connection.

View 1 Replies

Call A Dynamic Compiled Func(of ) Function Via Expression.Call?

Mar 22, 2012

I want to create an ExpressionTree where a Func(of Vector, Vector, Vector, Vector, Double, Double, Vektor) should be called. So I use

Expression.Call(Forces(0).Function.Method, {Vec1, Vec2, Vec3, Vec4, Double1, Double2})(Vec1-4, Double1-2 are declared as ParameterExpression and Forces(0).Function as Func(of Vector, Vector, Vector, Vector, Double, Double, Vector). But I get an AgrumentException, because Forces(0).Function.Method has seven Arguments. (System.Runtime.CompilerServices.Closure as seventh argument at Index 0).

View 2 Replies

VS 2010 : Convert A DLL Function Call Which Has The Callback Function Routine Called Within The DLL Function Call?

May 25, 2012

I am trying to convert a DLL function call which has the Callback function routine called within the DLL function call.The DLL function call signature is like this:

typedef void *HANDLE;
typedef HANDLE HACQDESC;
DECLARE_HANDLE (HWND);

[code]....

how to convert this DLL call to VB.NET and also how to create the callback function and send it as parameter to this function
call.

View 15 Replies

Call C# Form - Call The Form Called 'main'

Sep 22, 2010

I have a VB .NET 2010 application. I added a C# project to my solution. I tried to call the form called 'main'. However, I could not figure out a way to do that. What is the best way to do that? I Goggled, and did not find anything. Actually I noticed that my Developer converted everything to VB .NET.

View 5 Replies

Call A .net Dll From .net?

Nov 23, 2010

DLLs in .net are treated differently than in C++ and other programming languages.When you create a class library project in VS (for either VB or C#) you are creating a DLL. In order to call/use that DLL in another project you have to add a reference to your new program.Go to Project > Add Reference..., or right-click on the project that needs to use your DLL, and click "Add Reference...".

After a short wait you should see an Add Reference dialog box.There are several tabs across the top but each of the components that is listed in a tab represents a DLL. If you expand the "Path" column in the .Net tab you will see the DLL location.If your two projects are in the same solution, you should probably go to the Projects tab and add the project that you need.If your dll project is NOT in the same solution as your project that needs to use the dll, then go to the Browse tab and find your compiled DLL from your DLL project. This will add the DLL as a reference to your solution.

View 6 Replies

Call And How To Add Them?

Aug 13, 2010

Okay, this is my first newbie question so I'm sorry for this newbie question.I've look at Toolbox and I just can't find whatever this called.I don't even know what the name of it too so if anyone know what this called,

View 3 Replies

How To Add / Call A Dll

Aug 19, 2010

OK, I'm still trying to read EXIF information, and have found a DLL I want to try to do this - [URL] I've added the DLL to my project, but how do I actually include it and then us it. The example code I assume is C or something?

[Code]...

View 17 Replies

How To Call A Dll

Oct 12, 2008

How to call a dll in vb.net?

View 3 Replies

How To Call A Sub From Another Sub

Mar 25, 2011

How can i call a sub from another sub? I tried Call MyButton_Click but it didn't work.

View 1 Replies

Asp.net - How To Call Value From Web Form

Aug 19, 2009

I creat one WEB project, this project contain tow WEB FORM, In the first Web Form Design i have tow TextBox for Entring the date(All dataTable between this tow dates) and one Button, I want that when i press to to this Button it will load the second WEB FORM and show all the Data Table in DataGrid In this WEB FORM, So i need To call this tow TextBox value from the first WEB FORM to the second WEB FORM In Load_Page i will use this tow value in select statment. So i want to know how to call this to value from the first WEB FORM. I'am using VB.NET WEB APPLICATION.i have allrady DB in SQL .

View 4 Replies

C# - .net Call Php Function?

Oct 31, 2011

I am trying to call a php function from .net. I tried to a webrequest method but I am not sure how to specify the function to call in the url. A link below shows the method I am trying to call.[URL]..

View 2 Replies

C# - Call From .cs (or .vb) Into .aspx?

Feb 2, 2011

I have a Visual Studio solution, containing .cs and .vb projects, as well as .aspx files. As usual, the .aspx files implement an ASP.NET site and make calls to the .cs and .vb projects.

Is it possible to do the reverse... i.e. make a call from a .cs or .vb file to a method in a .aspx file? (Assume for the purpose of this question that there is a good reason for doing this)

View 3 Replies

C# - Way To Call Remote Dll?

Feb 23, 2010

Which is the best way to call remote dll? Where can i find examples for this?

View 1 Replies

Call / Use A VB6 Dll In Application?

Apr 11, 2009

How do I call/use a VB6 dll in VB.NET application? Welcome to the All-In-One Code Framework! If you have any feedback

View 1 Replies







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