Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Can this be done, and how...?

I am using VB 5 Pro, and want to know if and how I can do the following...it seems like I can, but I just cannot string the command/logic together to get it working properly.

Picture a button on a form.  When you click on the button, you get a text box appearing on the screen.  Click again and another appears, and so on and so on.  I want to 'dynamically create text boxes'....can it (or something very similar, maybe RichText) be done?  And if so, could you please give me a run down of the major commands involved (set command?  dim x as textbox?).

Thanks for you time
oreg
0
oreg
Asked:
oreg
  • 2
1 Solution
 
martiCommented:
This could be done with LOAD command.
0
 
martiCommented:
Put a RichTextBox1 on a form. Set its index to 0. And this is the code needed:

Private Sub Command1_Click()
    Static ind As Integer
   
    ind = ind + 1
    Load RichTextBox1(ind)
    RichTextBox1(ind).Visible = True
    RichTextBox1(ind).Top = RichTextBox1(ind - 1).Top + RichTextBox1(ind - 1).Height + 100
   
End Sub

You may put some Err handling as well.
0
 
oregAuthor Commented:
Thank you for the quick reply.  This worked great,
enjoy the points!

(ps: for anyone else reading this who does not know, unload RichTextBox1([number]) will get rid of the box)

oreg
0

Featured Post

Technology Partners: 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!

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