Add 4 Items In A Row In A List Box, For Instance?
Jun 21, 2010
I've made a program that can add 4 items in a row in a list box, for instance
Item Make Guarentee qty Price
toy car rover 1 1 £45.00
monkey monkey 2 1 £65.00
total: £100.00
The problem is I can't get the price to total up in a lable or textbox, however,I can make it work if i seperate the box and make two, listbox1 for item,make,gtee, qty and listbox 2 for price only.I don't want this because i want the row to delete in one go instead of deleting it from two boxes which is a time taker. code below
[Code]...
View 3 Replies
ADVERTISEMENT
Oct 1, 2009
I'm looping all the properties in an object via reflection:
For Each p As PropertyInfo In values.[GetType]().GetProperties()
If p.CanRead Then
'Do stuff
End If
Next
how to determine whether the property in question is a generic List(Of T)? If it is I need to loop the list itself.
I've experimented with GetType and TypeOf but have not managed to get anything working.
To clarify, I want to keep this generic. I do not want to specify the type of T, I need to loop the list items and call the ToString method on each item. T could be one of a number of different types (application specific reference types). Is it possible to do this without specifying types?
(VB.NET 2005 with .Net 2.0)
View 3 Replies
Mar 16, 2011
This program is supposed to allow the user to check items in a checked list box. If the item is checked, it goes into the Completed List Box on the right. The program then adds the unchecked items to the Pending list box on the left. I keep getting placement values (e.g. O,1,2) instead of the strings (e.g. "Key Returned") in the list box results (see photo attached)
Public Class frmCheckOut
Dim i As Integer
Dim cleaning As String = "Cleaning Inspection"
Dim damage As String = "Damage Repaired"
[code].....
View 3 Replies
May 16, 2011
Another program I am working on for fun, I am basically shuffling a list inside a listbox, what I want to do is delete the rest but not sure how to go through with that. At the moment I have this: [code] Just contains the code, declarations outside weren't included.So anyway, once clicked, it will call on the function to basically shuffle in a for loop, I was wondering if I should (or how should) create another function and call it in the click button or have just a loop in the click button so it deletes half the list. What I am doing is I have 20 list of items, I want the program to shuffle the items and then deleting the lower 10, meaning, if I had 10 items and wanted 5 top, I'd want: 0, 1, 2, 3, 4 and deleting 5, 6, 7, 8, 9.
View 7 Replies
Jul 20, 2011
I am attempting to read the results from a SQL query into a List(Of) and I can see the List.count while adding items to the List increments, however in another part of my code when I am attempting to read the List the List.Count returns 0. My List is as follows:
[Code]...
View 4 Replies
Nov 27, 2009
I have an error panel that is subbed in to a page if an error goes wrong to gracefully handle and display errors.Currently, I am just appending the error messages to a string and pushing that to a label. If you have multiple errors, this gets messy.I'd like to push each error to a list item in a bulleted, unordered list.How can I dynamically generate, from a vb codebehind file, new list items inside of an undordered list element?
View 2 Replies
Jan 25, 2011
I have two generic lists, named ListA and ListB. Both ListA and ListB could potentially have duplicate items. What I would like to do is use LINQ to grab the items in ListB that are not in ListA, but I'm unsure how to do so.
View 8 Replies
May 5, 2010
i want to search item A (from a list of X items) in list B but i want to get the item not found example Search ITEM A in LIST B if not found then return a print....if found continue with ITEM B..and so on.
View 5 Replies
May 23, 2012
That was probably bad title, but I'll illustrate what I'm trying to do. I have a method in a class that I need to call several times. The method returns a List(Of String). I'm just grabbing some information from a database.
VB.NET
Public Function GetTestList() As List(Of String)
Dim int As Integer = 0
[code]....
View 4 Replies
May 30, 2011
I have a List(Of MyObj), and I want to iterate through that list and compare each element to all other elements in the same list, excluding (if possible) the same element. I have a solution that works, but it's slow and uses double For loops. It may possibly have also summoned Cthulhu from his sleep. This below is a sanitized version of what I have:
Dim MyList As New List(Of MyObj)({Obj1, Obj2, Obj3, Obj4, Obj5, Obj6})
If MyList.Count > 0 Then
For i = 0 To (MyList.Count - 1) Step 1
[code]....
View 3 Replies
Mar 28, 2011
I am writing app in vb.net
I have two variables one with list of RoomRate and other with list of RoomTypes.
We have RoomRates and RoomTypes linked with RoomTypeInfo variable insite the RoomRate.
So how do i find the RoomTypes which donot have the RoomRates Defined.
My Sample Code:
class RoomType
property UIN as integer
property Title as string
end class
[Code]......
View 2 Replies
Nov 15, 2011
I want to know how to test the 1st list box if it has items more than the other list box but by one item, here is what i have: If lstInvisibleTv. Items.Count > lstInvisiblePc.Items.Count Then it works good if the lstInvisibleTv list box is greater than the other list box by one but it also works if it is greater the other one by one or more which I do not want. I want it to work just by one.
View 3 Replies
Feb 17, 2012
In a program that I'm putting together, I have a small class and in the program, I add instances of that class to a List(Of [that class]).Later in the program I test whether or not that list contains a particular instance of the class, but it fails to return true when I've proven that it's in there. I've since set up an iteration routine where it finds it, but it has me puzzled why the ".Contains" will not locate it.
My question is simple: When I have a List where I add an instance of a structure or class, does it not actually examine the contents of the structure or class inside it?
View 5 Replies
May 31, 2012
Why does this extension:
[code...]
Work for instance of type List(of Object) but not for instance of type List(Of List(Of Object).
Object is the most generic type in .net so List(of Object) is an Object and the extension shoud work?
View 3 Replies
Jun 3, 2010
How to use Generic List Where method based on index if there are mutiple 'similar' values, see example below
View 3 Replies
Jan 19, 2010
All i want to do at the end of my sub is make it go to the next instance in the list
say if its on A (the first instance) i do my thing then it rolls to the next instance B and so on
View 7 Replies
May 27, 2012
I have a program that will compare an array of grocery list items glist and an array of coupon item clist.When I compare the two and if there is a match somewhere in the array I want to have a picturebox visible.When there is no match, I want the picture box not to be visible. [code] The code seems to work great until I come to the else statement.When the code finds a match it displays the picture box and the msgbox without error, but as soon as the message box is cleared, even though i've input it as an ELSE statement, the picturebox goes false again.Does anyone have any idea of how I can "hold" the picturebox to stay visible while the match between the arrays exists?
View 18 Replies
May 2, 2012
i am writing a program that reads a excel report from accounting software with our weeks orders on... so basically the program reads a list of around 100 items which all works fine.I also have a database that holds info on each item, when the excel sheet is parsed the software checks to see if any new items have been added to the list that are not on the softwares database. this is where i am having the issue.I have two lists: ItemsOrdered & ExistsingItems.
All the items ordered this week are in ItemsOrdered and all the items not in the items in the database are in the ExistsingItems list. using these two lists how can i find items that are in ItemsOrdered but not in ExistsingItems.
View 2 Replies
Feb 16, 2009
I'm trying to search a generic list of 'User' business objects which has a property called 'Username': If (From u In colUsers Select u.Username Where Username.Equals(strUsername)).Count > 0 ThenI keep getting:Delegate to an instance method cannot have null 'this'.
View 16 Replies
Mar 27, 2012
I have a List object and I want to remove the duplicated items but leaving at least one of the duplicated items in the list;I wrote something like this however I would optimize this code for better performance, is there something faster?
Const chars As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Dim rnd As New Random()
Dim mylist As List(Of String) = Enumerable.Range(1, 100).Select(Function(i)
[code].....
View 3 Replies
Mar 22, 2010
i have little problem
i want to add items to listBox when i press in combo
i was doing it like this in vb6.0
List1.AddItem Val(Eastern.Text) * East / 100, 0
now i want to know how to do this in vb 2005
View 4 Replies
May 20, 2010
I have a list (of lines) and i'm looping through them and identifying certain ones as edges; I would somehow like to tag these lines so that when i loop through the list again later, I know which ones i tagged. I hope i'm explaining this ok. if not, let me know. What's the best way to deal w/ this type situation?
View 11 Replies
May 31, 2012
I have a List(of String). For example: {"C1", "C12", "C10", "C1", "C6", "C22", "C1", "C6"}. I am trying to write a function to give me a list of duplicates: {"C1", "C6"} in the list. Each duplicate will be listed only once. The function I wrote does give me anything back at all. I can't figure out why. how to translate that syntax into VB.net since I am not up to speed on LINQ yet. It is here: How to get duplicate items from a list using LINQ?
''' <summary>
''' Given a List(Of String), returns a list of items that are duplicated in the list.
''' Each duplicate returned is unique.
[Code].....
View 1 Replies
Feb 10, 2011
How can I add and save items to a List of Items in a listbox to an existing Text File in the bin folder? I'm already using IOStreamReader to pull information from the file, but I want the user to be able to add additional items (Name and Last name). Also, I'm having some issues organizing the list in the list box.How can I organize it pro pertly (2 columns)
View 1 Replies
Jun 2, 2011
I have a text box which I search SQL server which returns to values based on the text I pass the SP and then I want to add to the list box items so here is my code below the DataTable contains the item I want to return in the list, I have used this syntax to populate a Datagrid with no problems.[code]
View 2 Replies
Jan 28, 2010
I'm learning how to add items from a list box to a combo box. I'm trying to follow what's going on in the function loop and comparing a boolean and selected index. I can see that it's comparing the item chosen to each item already in the combo box to make sure that it's not already there. If function finds that it's not in the list it sends back that it is true that the item is not in the list.
It then continues to the statement that adds item to the list. The code for the double click event is working fine and items are getting added to combo box. However, the code for the add button isn't functional. I'm not seeing why it doesn't work? I coded out the original code, and replaced with something I thought might work but it still isn't functional. [Code]
View 1 Replies
Mar 9, 2009
[Code]...
Mod Edit: Please use code tags when posting your code. Code tags are used like so =>
View 1 Replies
Nov 19, 2009
I am creating a program with a few listboxes. And I want to assign a value to each of the items in the list box. Here are what my listboxes consist of and the values i want assigned to them.
Listbox1
Playstation Value is 100
Xbox Value is 90
WII Value is 80
[Code]....
I then want to take the values add them together and display them in a text box. So for example someone chooses playstation and call of duty that will be 130 and I want this to display in a textbox.
View 16 Replies
Mar 15, 2011
I have a List(Of DateTime) items. How can I check if all the items are the same with a LINQ query? there could be 1, 2, 20, 50 or 100 items in the list.
View 1 Replies
Mar 29, 2009
I am trying to write codes to clears all items in the list box. I try doing this with these codes:
Dim index As Integer
For index = 0 To lbxOrder.Items.Count - 1
lbxOrder.Items.RemoveAt(index)
Next
But I keep getting error: InvalidArgument=Value of '1' is not valid for 'index'.
View 8 Replies