Posted on 2006-05-19
The code below checks if an item in the list box is checked. If it checked, i add a rate to the current rate. If it is not checked, the rate reamains the same. it works perfectly with one item in the listbox. If i have two items i must select both items or all of the item in order to update the "rate".
Based on that description, the problem is related to the if statement up at the top of the code that analyzes if an item is checked or not.
Summaryzing: I need some help understanding why the code work properly for one item and it does not work properly for more than one item. Again when two items are displayed in the box, i must select both of them or the code thinks that it has either one has been checked.
For i = 0 To (chkEndorsement.Items.Count - 1)
If chkEndorsement.GetItemCheckState(i) = CheckState.Checked Then
If Not .BOF Then
Do While Not .EOF
endorsement = rs.Fields.Item("description").Value.ToString
endvalue = rs.Fields.Item("id").Value.ToString
Grid.Columns("Rate").Value = Val(endvalue) + Grid.Columns("Rate").CellValue(Grid.Row).ToString
LoadRate(formcodeval, township, range, cropclass, cropname, stateid, countyid)