Apr 23, 2012

How to Replace a Text Box With Another That Populates Data in VB6

,


Visual Basic 6 uses a designer to create text boxes you use to populate a database with information entered by your software users. If you need to replace a text box, you use the VB6 designer to delete the text box and add a new one to the form. The new text box has properties you use to define the type of information the software user can enter and submit to the database.

Instructions

    • 1
      Open your VB6 form file that contains the text box you want to replace. If the file opens in the code view, click the "Design" tab to view the form in the designer.
    • 2
      Click the text box you want to remove. Press the "Delete" key. Click "Yes" to confirm that you want to remove the text box. You can now add a new, replacement text box to the form.
    • 3
      Drag a text box control from the toolbox to the form. You can use the mouse to size the text box for both the width and the height. In the property panel, type a name for the text box such as "txtName" to indicate that the text box is used to enter a name string.
    • 4
      Click the "Save" button and press "F5" to run the debugger. This runs the form in the debugger, so you can quickly check to make sure the text box is placed in the right location on your form and it has the size requirements you want to use.
    • 5
      Double-click the form to open the code view. To use the new text box for the database entry, you must redefine the statement that retrieves the text box value.
    • 6
      Retrieve the text box value and assign it to the database string variable used to pass the data to the database. For instance, the following code retrieves the text box entry and assigns it to the "name" variable: "name = txtName.Text" without the quotes.
 

HowToYo Copyright © 2011 | Template design by O Pregador | Powered by Blogger Templates