Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim dt As DataTable
dt = New DataTable()
dt.Columns.Add("category1")
dt.Columns.Add("category2")
Dim newCustomersRow As DataRow = dt.NewRow()
newCustomersRow("category1") = "--Select Category1--"
newCustomersRow("category2") = "--Select Category2--"
dt.Rows.InsertAt(newCustomersRow, 0)
newCustomersRow = dt.NewRow()
newCustomersRow("category1") = "Item1"
newCustomersRow("category2") = "Item1"
dt.Rows.InsertAt(newCustomersRow, 1)
newCustomersRow = dt.NewRow()
newCustomersRow("category1") = "Item2"
newCustomersRow("category2") = "Item2"
dt.Rows.InsertAt(newCustomersRow, 2)
With cmbcategory1
.DisplayMember = "category1"
.ValueMember = "category1"
.DataSource = dt
End With
With cmbcategory2
.DisplayMember = "category2"
.ValueMember = "category2"
.DataSource = dt
End With
cmbcategory1.Refresh()
cmbcategory2.Refresh()
End Sub
.DisplayMember = "category1"
.ValueMember = "category1"
[b].DataSource = dt[/b]
comboBox1.SelectedValue = comboBox2.Text;
comboBox1.SelectedValue = comboBox2.Text;
Dim dt As DataTable
Dim dt1, dt2 As DataTable
Dim dsRFOX As DataSet
dsRFOX = New DataSet
dt = New DataTable("qryRF_MTL")
dsRFOX.Tables.Add(dt)
dt.Columns.Add("PartNo")
dt.Columns.Add("PartNoDesc")
Dim newCustomersRow As DataRow = dt.NewRow()
newCustomersRow("PartNo") = "1"
newCustomersRow("PartNoDesc") = "Descr 1"
dt.Rows.InsertAt(newCustomersRow, 0)
newCustomersRow = dt.NewRow()
newCustomersRow("PartNo") = "2"
newCustomersRow("PartNoDesc") = "Descr 2"
dt.Rows.InsertAt(newCustomersRow, 1)
newCustomersRow = dt.NewRow()
newCustomersRow("PartNo") = "3"
newCustomersRow("PartNoDesc") = "Descr 3"
dt.Rows.InsertAt(newCustomersRow, 2)
dt1 = dsRFOX.Tables("qryRF_MTL")
dt2 = dsRFOX.Tables("qryRF_MTL")
With cmbcategory1
.DisplayMember = "PartNo"
.ValueMember = "PartNoDesc"
.DataSource = dt1
End With
With cmbcategory2
.DisplayMember = "PartNoDesc"
.ValueMember = "PartNo"
.DataSource = dt2
End With
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.