TableAdapter.Insert vs. ComboBox1.ValueMember
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
1 post
Page 1 of 1
Hey
I have a small problem i cant seem to figure out ... I have a form with 1 textbox and 1 combobox. The combobox i setup on the form with "use databound items" and the databound items are :
Datasource : PersonBindingSource
Display member: PersonName
ValueMember : PersonID
I then try to enter info into the table
If u use this: Person_TableAdapter.Insert(1, 1) - It works fine
If i use this: Person_TableAdapter.Insert(Me.TextBox.Text, 1) - It works fine
BUT if i try this ... it fails
Person_TableAdapter.Insert(Me.TextBox.Text, Me.ComboBox1.ValueMember)
Why cant i use "Me.ComboBox1.ValueMember" to get the value of the combobox ? i just need to send the number for ValueMember (PersonID) to the table
This is the error message that pops up after a few seconds:
Conversion from string "PersonID" to type 'Integer' is not valid.
Thank for the help !!
NewGuy
I have a small problem i cant seem to figure out ... I have a form with 1 textbox and 1 combobox. The combobox i setup on the form with "use databound items" and the databound items are :
Datasource : PersonBindingSource
Display member: PersonName
ValueMember : PersonID
I then try to enter info into the table
If u use this: Person_TableAdapter.Insert(1, 1) - It works fine
If i use this: Person_TableAdapter.Insert(Me.TextBox.Text, 1) - It works fine
BUT if i try this ... it fails
Person_TableAdapter.Insert(Me.TextBox.Text, Me.ComboBox1.ValueMember)
Why cant i use "Me.ComboBox1.ValueMember" to get the value of the combobox ? i just need to send the number for ValueMember (PersonID) to the table
This is the error message that pops up after a few seconds:
Conversion from string "PersonID" to type 'Integer' is not valid.
Thank for the help !!
NewGuy
1 post
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023