Tuesday, January 23, 2007

How to populate a Listbox control by a table data


Guide MSDN does not propose one acceptable solution for this argument. With Firebird as database the things are different. The populate code for a Listbox is this (the names of the database and of the table or other it is clear that they may be personalized from you). The datasets are components of VB.net and are not typifyed:

Imports FirebirdSql.Data.FirebirdClient

_____________________________________________________________
Dim Fdataa1 As New FbDataAdapter("select*from tipo_di_opera", "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\Biblioteca.gdb")
DataSet2.Tables.Add("tipo_di_opera")
Fdataa1.Fill(DataSet2, "tipo_di_opera")
For i As Integer = 0 To DataSet2.Tables("tipo_di_opera").Rows.Count - 1
ListBox1.Items.Add(DataSet2.Tables("tipo_di_opera").Rows(i).Item(0))
Next i
ListBox1.Sorted = True

1 comment: