Can you tell me the neatest way to get the correct listbox item, and then assign it a new value from the database. The code below can't work because the
intAccount as an index would only work if the Account numbers in the listbox
were sequential. but they go like 1,2,4,5,8,10 etc .....
VB Code:
decAmount = ds.Tables(0).Rows(intR)("fldAmount") intAccount = ds.Tables(0).Rows(intR)("fkAccountID") If decAmount > 0 And decAmount Then ListBox1.Items(intAccount - 1).Deposit(Today, decAmount, "Auto Deposit")
Well I did it but kinda messy
VB Code:
intCount = ListBox1.Items.Count() For intR = 0 To intX - 1 decAmount = ds.Tables(0).Rows(intR)("fldAmount") intAccount = ds.Tables(0).Rows(intR)("fkAccountID") If decAmount > 0 And decAmount Then For inty = 0 To intCount - 1 intAcc = ListBox1.Items(inty).AccountNumber If intAcc = intAccount Then ListBox1.Items(inty).Deposit(Today, decAmount, "Automatic Deposit") End If Next End If Next


Reply With Quote