Hello forum I ask you a query, in a listbox in the change event, I have the following:
If rs <> Nil Then
While Not rs.EOF
Label16.text = rs.field (“weights”) Stringvalue.DefineEncoding (Encodings.UTF8)
ComboBox1.text = rs.field (“iva”) Stringvalue.DefineEncoding (Encodings.UTF8)
CheckBox1.Value = rs.field (“ivacheck”). BooleanValue
Rs.MoveNext
Wend
Rs.Close
End If
The problem I have is that when I select a row in the listbox it changes the combobox, label and checkbox, but the listbox row is not selected, now if I override CheckBox1.Value = rs.field (“ivacheck”) BooleanValue works fine, The problem is that the checkbox is happening, what am I doing wrong?
The data type of the db is tinyint
I do not understand your code, you’re looping over your whole recordsets only filling a label, combo- and checkbox?
Better use states on Checkboxes due Checkboxes can have more than just check/uncheck:
if yourvar then CheckBox1.State = CheckBox.CheckedStates.Checked else CheckBox1.State = CheckBox.CheckedStates.UnChecked
Public Function utfValue(extends dbf as DatabaseField) as String
dim s as String=dbf.StringValue
if s.Encoding=nil then
Return s.DefineEncoding(Encodings.UTF8)
else
Return s
end if
End Function
is too simple look :
Label16.text = rs.field (“weights”).utfValue
If rs <> Nil Then
While Not rs.EOF
Label16.text = rs.field ("weights") Stringvalue.DefineEncoding (Encodings.UTF8)
ComboBox1.text = rs.field ("iva") Stringvalue.DefineEncoding (Encodings.UTF8)
CheckBox1.Value = rs.field ("ivacheck"). BooleanValue
Rs.MoveNext
Wend
Rs.Close
End If
U can use SELECT DISTINCT or SELECT DISTINCTROW in sql query and remove WHILE - WEND loop