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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create textboxes at runtime

Status
Not open for further replies.

geethanandh

Programmer
Jun 5, 2002
21
US
hello
how to create a textbox dynamically during the run time of the program.

bye
geethanandh
 
Add a command button and a text box to a form. Set the text boxes index property to 0 then add this code

Private Sub Command1_Click()
Dim i As Long
For i = 1 To 5
Load Text1(i)
Text1(i).Move Text1(i - 1).Left, Text1(i - 1).Top + Text1(i - 1).Height
Text1(i).Visible = True
Next
End Sub

Hope this helps If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Ok. On your form you need atleast one instance of a textbox with an index set to 0. Use the default name (text1) to use it with the code below. Hope it is useful. I have added it to a click event of a command button.

Private Sub Command1_Click()

Dim intNextVal As Integer

'find next available index
intNextVal = Text1().Count

'add new text box
Load Text1(intNextVal)

'position textbox
Text1(intNextVal).Top = Text1(intNextVal - 1).Top + 600

Text1(intNextVal).Visible = True


End Sub

Darren To get what you want, you have to go through the crap, but to get through the crap you have to know what you want... [rockband]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top