FryDay_Boy
Newcomer
- Joined
- Jun 10, 2005
- Messages
- 3
Hello all,
I have use the following code to populate a combo box, but I would like to display more than the "empoyee id" (e.g. company, mobile phone number etc etc...) when Button2 is clicked. Can some one please enlighten me ??? Thank you very much !
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connstring As String
Dim cconnection As OleDbConnection
Dim DistrictAdapter As OleDbDataAdapter
Dim ds_name As New Data.DataSet
connstring = ..........
cconnection = New OleDbConnection(connstring)
cconnection.Open()
DistrictAdapter = New OleDbDataAdapter("Select * from [resource master list] where [First Name] = '" & TextBox1.Text & "'", cconnection)
DistrictAdapter.Fill(ds_name, "nametable")
ComboBox1.DataSource = ds_name.Tables("nametable")
ComboBox1.ValueMember = "Employee ID"
ComboBox1.DisplayMember = "LAST NAME"
cconnection.Close()
cconnection = Nothing
End Sub
------------------------------------------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox2.Text = ComboBox1.SelectedValue
End Sub
End Class
I have use the following code to populate a combo box, but I would like to display more than the "empoyee id" (e.g. company, mobile phone number etc etc...) when Button2 is clicked. Can some one please enlighten me ??? Thank you very much !
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connstring As String
Dim cconnection As OleDbConnection
Dim DistrictAdapter As OleDbDataAdapter
Dim ds_name As New Data.DataSet
connstring = ..........
cconnection = New OleDbConnection(connstring)
cconnection.Open()
DistrictAdapter = New OleDbDataAdapter("Select * from [resource master list] where [First Name] = '" & TextBox1.Text & "'", cconnection)
DistrictAdapter.Fill(ds_name, "nametable")
ComboBox1.DataSource = ds_name.Tables("nametable")
ComboBox1.ValueMember = "Employee ID"
ComboBox1.DisplayMember = "LAST NAME"
cconnection.Close()
cconnection = Nothing
End Sub
------------------------------------------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox2.Text = ComboBox1.SelectedValue
End Sub
End Class