Dynamically Create Textboxes, and Form Scrolling?

I have a program that asks for the number of transaction that happened. I would like it to be able to handle most situtations, but I don't know how many input boxes to have by default. More than likely, it will never be more than 10. I found a form scrolling sample and added rows of text boxes. I then made the text boxes invisible and changed the form scrolling thing to only check visible controls. That way, when the text boxes are invisible, the scroll bar goes away. The problem is, with many text boxes, the scrolling is slow and choppy. Some controls scroll up faster than others, so the form gets distorted a little. Is there a way to dynamically create text boxes when they are needed or is there a better way to get as many as I need?
GreggoryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HoweverCommaCommented:
Starting in VB6 you can add controls at runtim with this code. Pretty simple

Private WithEvents txtNew As VB.TextBox

Private Sub cmdNewUpDown_Click()

  Set txtNew = Controls.Add("VB.TextBox", "TextDynamic")
  txtNew.Text = "New TextBox"
  txtNew.Visible = True
 
End Sub

Private Sub txtNew_KeyPress(KeyAscii As Integer)
  KeyAscii = KeyAscii - 1
End Sub
0
vinnyd79Commented:
If you add 1 textbox and give it an index of 0 you can use its position to add new textboxes

Dim i As Integer

Private Sub Form_Load()
i = 1
End Sub

Private Sub Command1_Click()
Load Text1(i)
Text1(i).Top = Text1(i - 1).Top + Text1(i - 1).Height
Text1(i).Visible = True
i = i + 1
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HoweverCommaCommented:
As a sidenote you would probably be better off using a FlexGrid control.
Then you don't have to worry until i think 65K entries.... Never hit the limitation using it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.