PRB: Bound TextBox No Longer Populates During Form's Load Event

Last reviewed: August 5, 1997
Article ID: Q172100
The information in this article applies to:
  • Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0

SYMPTOMS

When a form is run, a bound Text box comes up blank even though a value is being stored to it's Text property in the Form's Load. In prior version of Visual Basic, the Text box came up populated if done in this manner.

RESOLUTION

In the Form's Load, instead of:

   Text1.Text = "This text should be in the text box."

use:

   Data1.RecordSet("<field name>") = "Text to show."

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Project.

  2. On the new form, add a TextBox control and a DataControl.

  3. Set the following DataControl's properties as shown:

          Data1
          .DatabaseName = nwind.mdb
          .RecordSource = customers
    

  4. Set the following Text Control's properties as shown:

          Text1
          .DataSource = Data1
          .DataField = contactname
    

  5. Place the following code in the Form's Load Method:

          Data1.Refresh()
          Data1.Recordset.AddNew
          Text1.Text = "This text should be in the text box."
    

  6. Run the form.


Additional query words: empty
Keywords : vb5all
Version : 5.0
Platform : WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.