FryDay_Boy Posted June 10, 2005 Posted June 10, 2005 Hello all pros and gurus, I have some problems with the combobox, I tried to populate it from an access database but instead I get System.Data.DataRowView in the combobox -_-" The following is the code : 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 DataSet connstring = ................. cconnection = New OleDbConnection(connstring) cconnection.Open() DistrictAdapter = New OleDbDataAdapter("Select * from [resource master list] where [last name] = '" & TextBox1.Text & "'", cconnection) DistrictAdapter.Fill(ds_name, "namelor") ComboBox1.DisplayMember = "first name" ComboBox1.ValueMember = "employee id" ComboBox1.DataSource = ds_name.Tables("namelor") cconnection.Close() cconnection = Nothing End Sub Please HELP ME!!!! Thank you very much Quote
penfold69 Posted June 10, 2005 Posted June 10, 2005 Try it in this order: ComboBox1.DataSource = ds_name.Tables("namelor") ComboBox1.DisplayMember = "first name" ComboBox1.ValueMember = "employee id" Quote
FryDay_Boy Posted June 10, 2005 Author Posted June 10, 2005 Try it in this order: ComboBox1.DataSource = ds_name.Tables("namelor") ComboBox1.DisplayMember = "first name" ComboBox1.ValueMember = "employee id" Hello Penfold69, thank you for your reply but I get the following error : An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll Additional information: Could not bind to the new display member. please advise Quote
penfold69 Posted June 10, 2005 Posted June 10, 2005 You might have to wrap the DisplayMember and ValueMember in []s, like: ComboBox1.DisplayMember = "[first name]" ComboBox1.ValueMember = "[employee id]" Try that! B. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.