Column in a Box
Hello Warlock051,
in my Sqlite based Application I fill a ComboBox with distinct Values from a querry.
I have to push a Button to fill it, so there is this Sub to do it:
Sub FPBDist_Click 'FPBDist = Button
SCText = StrEx.Trim(FPsC.Text)
SuText = FPTBSuch.Text
FPdC.Clear
DistStr = "SELECT DISTINCT " & Chr(34) & SCText & Chr(34) & " FROM [" & Main.AktTab & "] ORDER BY " & Chr(34) & SCText & Chr(34)
Di = 0 'Combobox Index Counter
Da = 1 'Actual Index to realise: Combobox entry = SCText
Main.cmd.CommandText = DistStr
Main.reader.Value = Main.cmd.ExecuteReader
Do While Main.reader.ReadNextRow = True
DistTStr = Main.reader.GetValue(0)
FPdC.Add(DistTStr)
If DistTStr = SuText Then
Da = Di 'Index for SCText combobox entry
End If
Di = Di +1
Loop
If SuText = "" Then
Da = 1
End If
Main.reader.Close
LbAnz.Text = FPdC.Count & " different values " 'LbAnz = Label shows Count values
LbAnz.BringToFront
FPdC.SelectedIndex = Da
End Sub
I hope it's helpful
Best Regards
berndgoedecke