Hi all, needed help to set the selection criteria using combobox, but there is a possibility to select "All Items" option. There are more than 2 combobox selection. Really need advise...
VB.NET:
strSQL = "SELECT nama from GridView"
Dim da As New SqlDataAdapter(strSQL, oconnection)
Dim ds As New DataSet
da.Fill(ds, "name")
Dim dt As New DataTable
'dt = ds.Tables(0)
dt.Columns.Add("name", GetType(System.String))
Dim drDSRow As DataRow
Dim drNewRow As DataRow
dt.Rows.Add("*", "All names") ---->just the toppest row that needed the selected value
For Each drDSRow In ds.Tables("name").Rows()
drNewRow = dt.NewRow
drNewRow("name") = drDSRow("name")
dt.Rows.Add(drNewRow)
Next
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
With ComboBox1
.DataSource = dt
.DisplayMember = "nama"
'.SelectedIndex = 0
End With
Last edited: