Results 1 to 1 of 1

Thread: Text Box Databinding

  1. #1
    HLeyes is offline C# Forum Newbie
    .NET Framework
    .NET 4.5
    Join Date
    Feb 2016
    Posts
    8
    Rep Power
    0

    Text Box Databinding

    I have form1 that has customer information textboxes that are databound to CustomerItem. If have a button on form1 for a test that works fine to retrieve the data that is displayed properly in the textoxes:

    private void btnRead_Click(object sender, EventArgs e)
    {
    int intKey = 11000;
    this.Cursor = Cursors.WaitCursor;
    CustomerItem = da.Read(intKey);
    customerItemBindingSource.DataSource = CustomerItem;
    txtCustomerKey.Focus();
    this.Cursor = Cursors.Default;
    }

    I have a search form that passes back a selected intKey to the same form1 to an almost identical routine. The CustomerItem object accurately shows the fields in debug mode (when inserting a breakpoint), but the same textboxes do not display the data when the routine is finished:

    public void ReadData(int intKey)
    {
    this.Cursor = Cursors.WaitCursor;
    CustomerItem = da.Read(intKey);
    //I can see the data in CustomerItem here when hovering the cursor.
    customerItemBindingSource.DataSource = CustomerItem;
    txtCustomerKey.Focus();
    this.Cursor = Cursors.Default;
    }

    Any idea what I am doing wrong?

    Thanks in advance,

    HLeyes
    Last edited by jmcilhinney; 04-24-2016 at 2:01 AM. Reason: Fixed code formatting.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •