0
我的窗體上有一個組合框。這與表格中包含該人員的職員姓名和職員參考資料。從ComboBox中讀取值並將其放入文本框中
組合框中顯示了所有員工的名字和選擇應創造值staffRef,我希望能夠選擇的名稱和StaffRef被填充到文本框中。
到目前爲止,我只能得到這個詞StaffRef去那裏。
這是我的代碼,希望你能幫助!
Private Sub frmAddCar_Load(sender As System.Object, e As System.EventArgs)
Handles MyBase.Load
'TODO: This line of code loads data from the 'namesstolenpool' table and drops
it into the combobox(Driver_Name).
Dim table As DataTable
table = BusinessData.VerifierLogic.Load("namesstolenpool",
New Dictionary(Of String, Object))
Driver_name.DataSource = table
Driver_name.DisplayMember = "displayname"
Driver_name.ValueMember = "staffref"
End Sub
'This should display the "value" of the combobox in the textbox.
Private Sub Driver_name_SelectedIndexChanged(sender As System.Object
, e As System.EventArgs) Handles Driver_name.SelectedIndexChanged
TextBox1.Text = Driver_name.ValueMember
End Sub
End Class
現貨!謝謝! –
歡迎@PaulBedford – Sathish