Consolidating And Filtering IList Items, Looking For Paterns, Practices, Or Existing Methods?
Sep 11, 2010
I'm reading a binary file into a bindinglist of (t); to be bound to a datagridview.Each line in the file represents a single transaction but I need to consolidate and or filter transactions that meet certain criteriaI know how to do this from a mechanical standpoint (looping the list while adding each item, and adding a new item, or merging the data with an existing item), but I'm looking for a practice, pattern, existing components, or something else that I'm missing (I'm drawing a blank for keywords to search).I don't want to reinvent the wheel if I don't have too. I'm particularly concerned with speed and performance issues with 100k plus records to process in some instances.Currently working with .NET 2.0, but will move to 3.5 if a particularly sexy solution exists.
View 2 Replies
ADVERTISEMENT
Nov 12, 2010
How could I add ObjectCollection items to an IList(Of SomeType)?I have tried with:
For Each obj As SomeType In listBox.Items 'ObjectCollection MyObject.ItProperty.Add(obj) 'IList Next
View 2 Replies
Aug 2, 2011
I'm trying to use a variable that is simply a list of a list of strings.I've declared it as follows:
Dim iRows As New List(Of List(Of String))
Then I'm trying to pass it as a parameter to another method and I've defined the method as follows:
Public Sub Import(ByVal Rows As IList(Of IList(Of String)))
For Each Row As IList(Of String) In Rows
ImportRow(Row)[code]....
Unfortunately, when I try to run that code I get the following error where it tries to pass my variable to my method.
System.InvalidCastException was unhandled by user code
Message="Unable to cast object of type 'System.Collections.Generic.List1[System.Collections.Generic.List1[System.String]]' to type 'System.Collections.Generic.IList1[System.Collections.Generic.IList1[System.String]]'."
When I change the method definition to use the types rather than the interfaces as follows, it works.
Public Sub Import(ByVal Rows As List(Of List(Of String)))
For Each Row As IList(Of String) In Rows
ImportRow(Row)[code]....
So, is it not possible to use generics with interfaces in this way? It works fine as long as I'm not nesting them.
View 3 Replies
May 13, 2012
I've got grid data and I want to allow the user to filter it.I'm curious what controls or methods you all have used successfully to ask the user for this type of information.I see EXCEL allows you to click a header - ask for a filter - and get arrows in the heading to allow you to see a DISTINCT list with CHECK BOXES.Google Docs spreadsheet does almost the exact same thing.
View 3 Replies
Feb 12, 2009
One of the features of the application I am working for is that it needs to check if an external windows application..lets call it A, is running. If it isn't running, then start it. If it is, then leave it.My idea originally was to use the process name as a filter. But the problem is that the process for application A is javaw.exe. Application A, belongs to a toolset, which has other windows applications, which have the same process name, javaw.exe.I already know that one of windows which has a javaw.exe process has "Edit"..in its title bar. So my algorithm to filter for app A is:
1. GetAllExistingOpenWindows
2. For each window in AllExistingOpenWindows
3. if window.processname=="javaw.exe" then
[code].....
View 1 Replies
Aug 15, 2011
I wanna search items like MS windows search for example if i wanna search mp4 files i should write "*.mp4" its enough my searching but if i ll use filter function i cant do this on datagridview couse when i want to search something i need to know full name of this record... its to bad for me... is there any way? can i do it?
View 2 Replies
Sep 24, 2008
I have a child form which contains a list of names and information, like age, sex, etc, in a multicolumn listview that gets populated from an xml file on the form load.There is also a combobox on this form that contains different Ages and when the user selects an age in the combobox I have it so the listview clears and the data reloads then removes all the rows that don't contain the matching "age" value in the age column.This works but it's really slow since each time a user makes another choice from the Combobox the whole listview is repopulated from the xml file.[code]I was thinking about doing the Name filter about the same way except on the textbox keyup event, but I fiqured I'd work at getting this working better first since this is way too slow.I don't really know any way of filtering the listview other than deleting the entries that don't match what's in the combobox.But then I end up reloading the whole thing when another selection is made from the combobox.
View 4 Replies
Nov 30, 2010
I have a listbox already filled with links from a search engine. I am trying to filter out some of the links from the same domain:
Error http://abc.net.au/news/stories/test/index.html Test cricket - Wikipedia, the free encyclopedia <---- remove this link because same as first entry
[code]....
View 3 Replies
Jan 23, 2012
Well I have a list of things I want to search based on multiple points of data...for example Resolution, 3D capable, touchscreen capable....etc....What is the best way for display someone can think of & filtering results by capability, I have none of it typed out, etc...like list of objects & capabilities, etc... alreat...so it can be made any way that is thought to be good(with speed as well) for many different listings...say 1,000 of them & it filters pretty much instantly....reading capabilities & such & the list itself is easy but how can I make a filter(unchecking something brings back things, checking something takes away only since well your adding capabilities to filter selection....I have pictures that can go with items too as well as a name & more information could be given directly with the method or clicking on the picture/item.
View 13 Replies
Jun 29, 2010
How can I view the methods that are hidden within objects please? For example I have a listview vbLstVw - But the only method I can seem to access is by double clicking it to get the
lvwPrac_SelectedIndexChanged
But I know theres more! (I don't know what there called, but for example):
lvwPrac_Initalize
lvwPrac_1337functionOfD00m
View 2 Replies
Jan 16, 2009
I created one ToolStripDropDownButton in vb.net. I will like to put methods for every drop down items and as well as the Button Menu.... how it possible
View 1 Replies
Jul 1, 2009
Not quite sure how to attack this one. If I have an array list how would I go about elminating duplicates but adding the values of those items together. In other words if I have one item that has a id of 9000 and a quantity of 5 and another item that has the same id of 9000 and a quantity of 10. How would I eliminate the duplicate but add the quantities
View 3 Replies
Jan 8, 2010
I've got to the stage where I want to make changes to my application so that all of my forms appear to the user as a single window.
I have a main Form with a menu bar which opens up three separate forms. Only one forms is visible at any time.
One way to do this, that I can think of, is to place all the controls from each of the "auxiliary" forms on a panel contained in the main form and then show and hide the panels, when needed. I can envisage this being a big headache though.
Another way would be to give each form a menu bar and make it look like the main form so that the user would not know the difference (with a bit of luck).
I just wonder if there are better ways to do this. Maybe if I could incorporate one form into another form?
View 2 Replies
Nov 1, 2010
I have a datagridview i use to load alot of klients into a combobox. The values of the datagridview is a connection to a MySQL db.
What it's suppose to do, is to: When clicking the combobox, it should make a list from the datagridview, getting all the names from the klients.
My problem is that it gets dublicated, and will use to much memory at a moment.
I've tryed to check if the item it was about to add allready existed in the datagridview, if it was, it shoudn't add it again, however my code failed, and I'm having huge CPU and RAM useage when running this problem for more than 30mins.
My code:
Private Sub loadCustomers()
SQL = "SELECT * FROM kunder;"
Try
[Code].....
The code above is only checking for dublicated in the combobox, And I want the code to also check for dublicated items in the datagridview.
Or a way to clear the datagridview right after the items are inserted into the combobox?
View 1 Replies
Apr 22, 2009
How to remove already existing items in the checkedlistbox?
View 16 Replies
May 21, 2011
I have a listview which contains information. This information is retrived from database, 'till now ok. The problem is: I must update the existing items on listview and insert the new ones.
View 4 Replies
Aug 1, 2011
I am converting a VB 6 app to VB.Net. In the vb 6 version I have a table that contains roughly 80 fields. Over that table the users currently have a single form which gives 12 diferent views. Each view is placed on a different tab, which, although giving a distinct set of fields per tab, also leads to a ton of duplicated code. Changing the underlying table is not an option.
What I would like to do is to use a single datasource (containing all 80 fields), a single datagridview on the form, and have a combobox act as the filter choice for the differing views. Does my solution seem like the right way to handle this? If so, I'm not sure I know which controls would best be used.
View 3 Replies
Apr 26, 2010
I have an app published using ClickOnce. When an app is published that way, you get a temporary certificate which expires in a year. My year will be up in a couple months, and I am considering my options.One option, which a colleague is using, is to build a more sustained certificate using makecert.exe. By doing this, I can get a certificate of arbitrary length (or so I am told, as I haven't actually followed this route, yet). The problem with this route is that MS is pretty clear that makecert is for testing purposes.
I can also see that I could go to verisign or some such and buy a certificate, but that has a significant cost (well, I'm sure my employer wouldn't be too concerned about it, but it seems pretty high to me). The program has very narrow applicabiliity and narrow appeal (it has to do with counting fish). What I am wondering is whether there is sound reason to go with a certificate that is more than what makecert will create, and what that reason is? Additionally, I'm looking for information as to whether an internal CA, such as we have, which can make a certificate, will cause me any trouble if I use it to sign a ClickOnce app that won't be used entirely internal?
View 7 Replies
Dec 8, 2009
I have a general question regarding best practices for exception handling. I have a class library that uses structured error handling. The functions in the library generally perform some mathematical calculations and all return a boolean value indicating whether an exception occured or not (i.e. exception occured = true, no exception = false). The actual calculated result in the function is returned as a ByRef parameter.
Anyway the input variables for my calculations are all passed to the funtions as parameters. I perform some basic checks on these inputs (e.g check that an input is not negative etc) as part of the function code. The next stage is where im unsure of the best way to do things. Using the example i just mentioned, if an input parameter is negative, I can either throw an exception such as "ArgumentOutofRange", or i can simply show a messagebox with some info about what happened. Either way i do it the function will return true. At the moment i am throwing an exception, but on reading the "Best practices for exception handling" it is recommended you dont throw an exception for things that can be checked programatically because of "performance/overhead issues".
I'm a little confused by what they mean by this. What kind of overhead are they talking about? Slower program? More disk space required? More memory required? When my functions return true, the calling methods basically drop everything and stop calculations (exit sub), so im not sure that the overhead issues they are talking about are as important to me. It seems easier and neater to throw an exception and utilize some global error strings and pass some parameters rather than copy and paste messagebox.show() all the time, and modify the text to suit the situation. Another argument for me would be that both methods of exception handling utilize a messagebox, which stops code execution until the user does something. So i cant see the issue with the performance overhead.
View 5 Replies
Aug 29, 2011
I'm an avid programmer, and I'm trying to teach myself more professional practices, but Ilook over my code, and point out any mistakes, or bad practices I may have attached to this actually working bit of code. It consists of a procedure for retrieving, sending, and above all connecting to a server program. As for the various amounts of sloppy commented out code, after a long time clearing my head, I came to my senses so to speak.
Imports System.Net.Sockets
Imports System.Text
Imports System.Threading.Thread
View 4 Replies
May 2, 2010
I have read and worked through all of the examples in the book "ADO.NET 2.O", but there is so much there with so many ways to handle data, I am having difficulty translating the examples into my own real life application. I am confused about creating runtime connection strings, connection strings in my app.config file, connection strings in the properties for a sql connection control, etc.
I have a midichildform with a datagridview control, and I use a table adapter to edit and update the SQL Server 2005 Express edition database. There is no problem there. However, I also have a button control that I want to use to "process" the data that has been updated with the table adapter. I want to open the updated table, read each record on at a time, manipulate the data and add a records to another table. Do I have to create a connection string and an oleDBconnection? Or can I somehow use the connection string that is in my app.config file? [Code]
View 9 Replies
May 28, 2009
What are good things to check for, with respect to error-handling, when you are dealing with the data-access-layer? For example, let's assume I have this function..
Public Function UserExists(ByVal userName As String) As DataTable
Dim dt As Object = Nothing
Dim arSqlParameters(0) As SqlParameter
[code]....
How would you go about ensuring that your code elegantly handles anything unexpected in a situation like this?
View 5 Replies
Aug 29, 2011
This is the original code in c#
public class CategoryRepository: RepositoryBase<Category>, ICategoryRepository
{
public CategoryRepository(IDatabaseFactory databaseFactory)
: base(databaseFactory)
[Code]...
Does anyone has an idea what i should change to let it work and let my UserRepository use the methods in RepositoryBase while implementing the IUserRepository?
View 1 Replies
Jul 8, 2011
How do I use the IList(Of T).Max function in my example below?
Dim myList as IList(Of Integer)
For x = 1 to 10
myList.add(x)
Next
'Error: 'Max' is not a member of 'System.Collections.Generic.IList(Of Integer)'
MsgBox(myList.Max())
View 2 Replies
Nov 23, 2010
i have to develop API in .Net 4.0 which can be used in VB 6.0,i know how to use this and currently i am using my this API in VB successfully.but Stuck at one place,i have collection class and i have to expose it to VB with having functionality of List class of .Net.[code]i know that generic is not supported in VB, but i think with this declaration in VB 6.0 it creates interface class for class B as IList.but in VB using object creation of class B it doesn't provides me members of LIST in intellesense like (Add,Remove of List Class)
View 2 Replies
Jun 24, 2011
I am working with a vb program, but there is something strange on one of my .vb code pagewhen i put the "dot" afther the object name its dont show the methods availables for this objectbut on other vb code pages i can see it. but in this one no.for exmaplethis is a piece of code: Dim sb As New StringBuilder()
View 3 Replies
Mar 29, 2010
I am not sure how clear my question is by the title, but I am trying to make Class methods instead of Instance methods in Visual Basic that way I don't have to waste memory and code creating temporary objects to execute methods that don't need instance variables.
I am not sure if you can do that in VB but I know you can in Objective-C by using either a "+" or "-" sign in front of the method declaration. And in C++ (at least I think, I can't remember) you put the static keyword or const keyword in front of the function.How would I do this in VB if it is possible? Or should I just make a separate set of functions that are not members of a class?
View 2 Replies
Jun 26, 2009
I am creating a generic class that is Implementing IList(Of T) which requires that I implement the GetEnumorator of both IEnumerable(Of T) and IEnumerable. When looking at the members of IList(Of T) I see only one GetEnumorator function, yet it implements IEnumerable(Of T) and IEnumerable. How can I use one function to implement both interfaces when the function definitions only vary by return type?
View 8 Replies
Mar 17, 2012
is it possible to add multiple strings per item in a Ilist?If so can someone point me in the right direction? I've looked on the msdn and can only find examples on how to add one string per item
View 16 Replies
Feb 8, 2011
I'm using the Dynamic LINQ library code sample to dynamically return some data. The number of columns I'm returning is variable depending on user input. I'm enumerating the IQueryable into an IList. What I need to do is step through the Ilist one field at a time. I can get one row at a time by iterating through the IList's rows but I can't for the life of me pull one field out of the collection.For example, here I'm returning two columns (hard coded for testing but in prod it will be variable depending on what fields the user chooses):
Dim Dynq = dc.dt _
.Where("RUN_ID = """ & runNumber & """ and Upper_Pressure > 95") _
.OrderBy("Upper_Pressure") _
[code]....
Now I can pull a field out of the Ilist if I know the column name with something like:
something.Run_ID.ToString
but I wont know the columns I'm using until runtime and dynamically inserting it in a variable that's set at runtime doesn't work.So in Summary I have a Ilist that looks something like this
1 | Auto
2 | Auto
3 | Manual
4 | Manual
and I'd like a way to return
1
and then return
Auto
and then
2
etc...
View 1 Replies