Question Data Binding Issues

Kiran Dhananjayan

New member
Joined
Sep 25, 2009
Messages
1
Programming Experience
Beginner
Hi all,
I am creating a database for Employees. In that I have some issues.

I am trying to bind my data using data source. In the list box properties I set
lstemp.Datasource = Employeedatabase
lstemp.Displaymember = "EmplyeeName"
lstemp.Valuemember = "EmplyeeId"

I want to get my employee Id for displaying data in text boxes. How can get the data of the highlighted employee name in the list box to text boxes

Regards,
Kiran
 
First up, let me make a small note that you should be setting the DisplayMember at least BEFORE setting the DataSource. I tend to set the ValueMember first too but I'm not sure that that makes any difference.

As for the question, given that you're already using data-binding, you should bind your TextBox too, e.g.
VB.NET:
myTextBox.DataBindings.Add("Text", Employeedatabase, "EmplyeeId")
I'd also recommend that you spell "Employee" correctly in your column names.
 
Back
Top