Fill textboxes with data from a datatable

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

I have two textboxes on a form that I need to have filled with data from my
datatable.

TextBox Names
tbUserName
tbPassword

Corresponding fields in the datatable are:
User_Name
Password


Many Thanks,
Derek
 
Derek,

You could just create a data binding on the textbox. Basically, the
TextBox class exposes the DataBindings property. There is an Add method on
the collection it exposes. Just pass the name of the property to bind to
the data, the data source, and the name of the column (if the source is a
table) or the name of the table and the column separated by a period (if it
is a dataset).

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top