Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Databind textboxes and checkboxes

Status
Not open for further replies.

ljwilson

Programmer
May 1, 2008
65
0
0
US
I have a fairly simple Windows Form (UserControl). What I have is two tabs (a tab control) that both reference the same UserControl. I have several Textboxes and Checkboxes that need to get populated from a DataTable. The DataTable is working fine (getting data from an SP). I have also build the SP's for adding, updating and deleting rows.

Here is my roadblock. I cannot seem to be able to bind the textboxes and checkboxes to the data in the DataTable. What's more, there could be several records returned in the datatable and I need to know when there are more than one (person has more than one instance of a license. Here is what I got:

Code:
 Me.txtName.DataBindings.Add("Text", dtUserDetails, "FullName")
            Me.txtUserId.DataBindings.Add("Text", dtUserDetails, "UserId")
            Me.txtLicType.DataBindings.Add("Text", dtUserDetails, "LicenseType")
            Me.txtIssueDate.DataBindings.Add("Date", dtUserDetails, "LicenseIssueDate")
            Me.txtExpDate.DataBindings.Add("Date", dtUserDetails, "LicenseExpirationDate")

Then in a separate sub, I check for DataTable changes:
Code:
Dim DEALicenseChanges As New DataTable
DEALicenseChanges = getStaffListChanges()

This never sees a change and the Textboxes are not getting populated.

I will also need to know how to do the same thing with Checkboxes.

Thanks!
LJ
 
If I just assign the values in the datatable, it will display the data, the problem is that the data isn't bound so when I change a value in the textbox and then check for changes in the datatable, there are none.

LJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top