• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Adding control on the fly

I have to text box in a form i want to add many more text box on the same form but i have to had those text box when the programm is running so on the fly and as much as i need, this number may vary from each time i run the program.

Anybody has some code to explain that::
0
dabellei
Asked:
dabellei
  • 3
1 Solution
 
shogiCommented:
dim YouTexteBox() as TextXXX
dim nYouTexteBox as integer

nYouTexteBox = nYouTextBox + 1
load YouTexteBox(n)

' move at the position your textebox
YouTextBox(n).Visible = True

if you need more information ask me,
Have a good day
Shogi


0
 
dabelleiAuthor Commented:
i've try your code it's not working as is r maybe i don't do it right

i've replace the n with nYouTextBox.

I want to create a new control label on mw form from nothing there's nothing on the form at the beginning.  Send me a working code that you test before..

Thank's
0
 
shogiCommented:
Create a new project.

Put a commandButton :

Name = cmdMyListOfButton
Index = 0
Visible = False

===============================
Option Explicit
Dim nButton As Integer

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   
    If nButton <> 0 Then
      Load cmdMyListOfButton(nButton)
   End If
 
   cmdMyListOfButton(nButton).Top = Y
   cmdMyListOfButton(nButton).Left = X
   cmdMyListOfButton(nButton).Caption = "Button" + CStr(nButton)
   cmdMyListOfButton(nButton).Visible = True
   nButton = nButton + 1
End Sub
==============

I hope that it'll help you.
Shogi
0
 
shogiCommented:
Sorry I make the example with buttonCommand, but with TextBox it's the same.

Shogi.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now