Adding control on the fly

Posted on 1998-09-23
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Accepted Solution

shogi earned 280 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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