Hello,
I hope one of you can please help me with a small problem i am having....
Ok i have 2 list boxes.. Qty and Cost both of these are populated from a sql database. The code is suppose to read through the listboxes and multiple the Cost by the Qty and then replace the Cost with the new result. The Cost listbox is populated with the cost of one item. The reason i am not doing this calculation in the sql query is because the sql query is very complicated filter out a bunch of stuff to show just the qty of the item...
sql query = "SELECT DISTINCT Trans.TransDescription, Count(Trans.TransDescription) AS Qty FROM Trans WHERE Debit = '0' AND Checked = '0' GROUP BY Trans.TransDescription"
ok here is the vb.net code everything works fine it just wont update the selected itme with the new value..
Dim Y As Integer = 0
Dim Z As Object
Dim ZZ As Object
Dim ZZZ As Object
Try
Do Until Y = LbCurrentAccountQty.Items.Count
LbCurrentAccountQty.SelectedIndex = Y
LbCurrentAccountCost.SelectedIndex = Y
Y = Y + 1
Z = LbCurrentAccountQty.SelectedItem
ZZ = LbCurrentAccountCost.SelectedItem
ZZZ = (Z * ZZ)
'Code works up until here. It just does not want to update the cost.
LbCurrentAccountCost.SelectedItem = ZZZ
Loop
Catch ex As Exception
MsgBox(ex.Message)
End Try
Thanks very much for your help
I hope one of you can please help me with a small problem i am having....
Ok i have 2 list boxes.. Qty and Cost both of these are populated from a sql database. The code is suppose to read through the listboxes and multiple the Cost by the Qty and then replace the Cost with the new result. The Cost listbox is populated with the cost of one item. The reason i am not doing this calculation in the sql query is because the sql query is very complicated filter out a bunch of stuff to show just the qty of the item...
sql query = "SELECT DISTINCT Trans.TransDescription, Count(Trans.TransDescription) AS Qty FROM Trans WHERE Debit = '0' AND Checked = '0' GROUP BY Trans.TransDescription"
ok here is the vb.net code everything works fine it just wont update the selected itme with the new value..
Dim Y As Integer = 0
Dim Z As Object
Dim ZZ As Object
Dim ZZZ As Object
Try
Do Until Y = LbCurrentAccountQty.Items.Count
LbCurrentAccountQty.SelectedIndex = Y
LbCurrentAccountCost.SelectedIndex = Y
Y = Y + 1
Z = LbCurrentAccountQty.SelectedItem
ZZ = LbCurrentAccountCost.SelectedItem
ZZZ = (Z * ZZ)
'Code works up until here. It just does not want to update the cost.
LbCurrentAccountCost.SelectedItem = ZZZ
Loop
Catch ex As Exception
MsgBox(ex.Message)
End Try
Thanks very much for your help