D
Dickson
Need some help on listbox which bind to datasource. Here is what i did :-
Dim sql As String = "SELECT supp_code,supp_name FROM
tblSupplier"
Dim DA As SqlDataAdapter = New SqlDataAdapter(sql, conn_str)
Dim DS As New DataSet
DA.Fill(DS, "Supplier")
lbListSupplier.DataSource = DS.Tables("Supplier").DefaultView
lbListSupplier.DataTextField = "supp_name"
lbListSupplier.DataValueField = "supp_code"
lbListSupplier.DataBind()
My problem is how can I delete an item from the listbox or add an item into
the listbox since it was bind to a datasource.
I do not want to re-populate the listbox again by querying the database.
Another problem is since the listbox is bind to a datatable, is that any way
I can use function like CType to extract the data
bind to listbox and put into a datatable? Thanks.
Dim sql As String = "SELECT supp_code,supp_name FROM
tblSupplier"
Dim DA As SqlDataAdapter = New SqlDataAdapter(sql, conn_str)
Dim DS As New DataSet
DA.Fill(DS, "Supplier")
lbListSupplier.DataSource = DS.Tables("Supplier").DefaultView
lbListSupplier.DataTextField = "supp_name"
lbListSupplier.DataValueField = "supp_code"
lbListSupplier.DataBind()
My problem is how can I delete an item from the listbox or add an item into
the listbox since it was bind to a datasource.
I do not want to re-populate the listbox again by querying the database.
Another problem is since the listbox is bind to a datatable, is that any way
I can use function like CType to extract the data
bind to listbox and put into a datatable? Thanks.