I'm having trouble getting some data from a combobox. I have a series of comboboxes that populate as you make selections from the boxes. Each combobox is using data that is pulled from a SQL database into a dataset. This all works.
When I get to the last box, I want to view one column from this dataset, but have the selected value be from another column. For some reason, it will not select this other data. In the code sample, after the user goes through the procedure to select everything, the click a button. For test purpose, this button pops up a msgbox with the data that is desired. Right now, the data desired is NOT appearing. Instead I just receive a "-1". Anyone know anything about this?
Public main As frmDashboard
Public view As frmTrainingView
Dim strID As String
Private Sub frmSelect_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.DocHeaderTableAdapter.Fill(Me.DataSet1.docHeader)
Dim tblmodels As DataSet1.docHeaderDataTable
tblmodels = Me.DocHeaderTableAdapter.GetAllModels
Me.ComboBox1.DataSource = tblmodels
Me.ComboBox1.DisplayMember = "Model"
Me.ComboBox1.ValueMember = "Model"
End Sub
Private Sub Model_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim tblparts As DataSet1.docHeaderDataTable
tblparts = Me.DocHeaderTableAdapter.GetPartByModel(Convert.ToString(ComboBox1.SelectedValue))
Me.ComboBox2.DataSource = tblparts
Me.ComboBox2.DisplayMember = "Part"
Me.ComboBox2.ValueMember = "Part"
End Sub
Private Sub Part_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim tblman As DataSet1.docHeaderDataTable
tblman = Me.DocHeaderTableAdapter.Getmanning(Convert.ToString(ComboBox1.SelectedValue), Convert.ToString(ComboBox2.SelectedValue))
Me.ComboBox3.DataSource = tblman
Me.ComboBox3.DisplayMember = "Manning"
Me.ComboBox3.ValueMember = "Manning"
End Sub
Private Sub Manning_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Dim tblpos As DataSet1.docHeaderDataTable
tblpos = Me.DocHeaderTableAdapter.GetPos(Convert.ToString(ComboBox1.SelectedValue), Convert.ToString(ComboBox2.SelectedValue), Convert.ToString(ComboBox3.SelectedValue))
Me.ComboBox4.DataSource = tblpos
Me.ComboBox4.DisplayMember = "Position"
Me.ComboBox4.ValueMember = "Position"
End Sub
Private Sub Position_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
Dim tbldoc As DataSet1.docHeaderDataTable
tbldoc = Me.DocHeaderTableAdapter.GetDoc(Convert.ToString(ComboBox1.SelectedValue), Convert.ToString(ComboBox2.SelectedValue), Convert.ToString(ComboBox3.SelectedValue), Convert.ToString(ComboBox4.SelectedValue))
Me.ComboBox5.DataSource = tbldoc
Me.ComboBox5.DisplayMember = "docType"
Me.ComboBox5.ValueMember = "docID"
End Sub
Private Sub btnBegin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
strID = Convert.ToString(ComboBox5.SelectedItem)
MsgBox(strID)
End Sub