Click here to Skip to main content
15,902,445 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I was trying to develop a simple order processing system for my project. I'm having problems in comparing two list of arrays eg; brands, items. I've got one listbox of brands and another of items. Suppose a user selects Brands: Apple, lenovo, Dell and items : Macbook, Pc, Laptop etc. then the price should be displayed in a label or textbox in the form or new form.
Hope to see a reply quickly.
thanks
Posted
Comments
OriginalGriff 21-Oct-12 8:25am    
What kind of problem are you having?
Prabin Shakya 21-Oct-12 8:39am    
i have two listboxes. listbox1 items:(macbook, pc, ipad etc.) and listbox2 price:(600.500,300). I want to match the item with the price and then display in the textbox/label. Thanks.

Here is a sample of what i am doing currently:
Dim lstitems0 As String() = {"Apple-Monitor", "Macbook", "IMac", "Ipad"}
Dim lstPrice0 As String() = {200.0, 600, 500, 300}
Dim lstitems1 As String() = {"Dell-laptop", "Dell-Monitor", "Dell-Keyboard"}
Dim lstPrice1 As String() = {600.0, 200, 300, 500}

Dim lstitems2 As String() = {"Hp-laptop", "hp-Monitor", "hp-Printer", "hp-Keyboard"}
Dim lstPrice2 As String() = {400.0, 200, 39, 100}

Dim lstitems3 As String() = {"Acer-laptop", "Acer-Monitor", "Acer-Keyboard"}
Dim lstPrice3 As String() = {250.0, 100, 120}

Dim lstitems4 As String() = {"lenovo-laptop", "lenovo-Monitor", "Lenovo-Keyboard"}
Dim lstPrice4 As String() = {550.0, 170, 120}



If cboxBrands.SelectedIndex = 0 Then
chklstboxItems.Items.Clear()
chklstboxItems.Items.AddRange(lstitems0)
ListBox1.Items.AddRange(lstPrice0)
Form2.pricetxtbox1.Text = i

ElseIf cboxBrands.SelectedIndex = 1 Then
chklstboxItems.Items.Clear()
chklstboxItems.Items.AddRange(lstitems1)
ListBox1.Items.AddRange(lstPrice1)
ElseIf cboxBrands.SelectedIndex = 2 Then
chklstboxItems.Items.Clear()
chklstboxItems.Items.AddRange(lstitems2)
ListBox1.Items.AddRange(lstPrice2)
ElseIf cboxBrands.SelectedIndex = 3 Then
chklstboxItems.Items.Clear()
chklstboxItems.Items.AddRange(lstitems3)
ListBox1.Items.AddRange(lstPrice3)
ElseIf cboxBrands.SelectedIndex = 4 Then
chklstboxItems.Items.Clear()
chklstboxItems.Items.AddRange(lstitems4)
ListBox1.Items.AddRange(lstPrice4)
End If


End Sub
Prabin Shakya 21-Oct-12 9:06am    
any solutions please? I need this project to be done urgent. Please reply quick anyone..
Thanks

1 solution

We're not here to do your homework for you, so you're not going to get any code written for you.

We also answer questions by volumnteering our own time here, not on your demands.

You've got some very serious flaws in your design. You're storing all of your data in listboxes, which does nothing for you. Storing your information for a single item in a structure, like "Manufacturer, ProductName, Price", then you can store each structure item in a queryable list.

You can then populate the listboxs with the data in the list. Once the user selects items in the listboxs you can then go back to the list items and add up the prices of what has been selected.
 
Share this answer
 
Comments
Prabin Shakya 21-Oct-12 13:56pm    
@Dave Kreskowiak whoever you think you're.. anyways, thanks for the info but i entered this website just to seek some help, im not telling you or anyone to do my homework, get me? This is my course project but im still learning VB for my future career. If you dont want to help, you could have not written anything instead of making a so called GENIUS out of yourself.
SALUTE!!
Dave Kreskowiak 21-Oct-12 14:56pm    
First, I didn't make a "genius" out of myself.

Second, i told you what the best way to do this is. If you don't want to listen, piss off.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900