Making NEW OBJECTS

How do I make a new object at run-time? for example...if i have a blank form how would i make a new textbox and stick it in the form?

Comments

  • : How do I make a new object at run-time? for example...if i have a blank form how would i make a new textbox and stick it in the form?

    You must first have a TextBox on your form, even if it is invisible. You must make it a control array by setting it's index property to zero. Then you can create textboxes like this:

    Load txtMyTextBox(i)

    ... where i is some integer value that has not already been loaded. To get rid of them you just Unload in place of Load and use the index (i) of the one you want to destroy. You'll have to position them using the .Move method or the .Left, .Top, .Width, and .Height properties.
  • alright thanks that was real easy
  • [b][red]This message was edited by Malcolm at 2002-7-30 15:47:13[/red][/b][hr]
    : alright thanks that was real easy
    :

    I'm wasting my time again here, but just incase this info is useful I'm posting it:

    If you have VB6 there is another way with Controls.Add . Only on rare occasions does it give any advantage over the method already outlined. And given that your username suggests that you have VB5, I won't bother posting the code unless you request it.




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories