Adding control on the fly

Posted on 1998-09-23
Last Modified: 2010-04-30
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::
Question by:dabellei
  • 3

Accepted Solution

shogi earned 70 total points
ID: 1436273
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


Author Comment

ID: 1436274
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..


Expert Comment

ID: 1436275
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.

Expert Comment

ID: 1436276
Sorry I make the example with buttonCommand, but with TextBox it's the same.


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Replace Formatted Numbers with text 9 61
How to debug this code 7 56
Visual Studio 2005 text editor 10 35
how to know if my Checkbox is True in VB6.0? 9 41
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

20 Experts available now in Live!

Get 1:1 Help Now