Solved

Creating Text Boxes at run-time

Posted on 1998-11-11
5
130 Views
Last Modified: 2010-04-30
How would I create text boxes at run time, then manipulate or add text to them? Can this be done?
0
Comment
Question by:cantrell
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
I think you need to start with a control array for the first text box and then you can dynamically add elements to the array. However the control itself cannot be created from scratch in VB5. VB6, I have heard, allows this.

M

0
 
LVL 2

Author Comment

by:cantrell
Comment Utility
Could you give me an example?
0
 
LVL 2

Expert Comment

by:schild
Comment Utility
You put one TextBox in the form, you may want to make it invisable. Then you set the "Index" property to 0.

At runtime you doing this:
Load TextBox1(1)
TextBox1(1).Visible = True
TextBox1(1).Top = TextBox1(1).Top + 500

Good Luck
Schild
0
 
LVL 2

Author Comment

by:cantrell
Comment Utility
Ok, that creates one text box. Now, how about the others?
0
 
LVL 2

Accepted Solution

by:
schild earned 50 total points
Comment Utility
all you have to do is changing the Index value
because you cant repeat loading the same control several times
so if you want to load 10 controls do like this

For CtrlIndx = 1 to 10
  Load TextBox1(CntrlIndex)
  TextBox1(CtrlIndx).Visible = True
  TextBox1(CtrlIndx).Top = TextBox1(CtrlIndx).Top + 500*CtrlIndxNext
Next

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now