Howdy, Stranger!

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

Categories

Making NEW OBJECTS

VB5begginnerVB5begginner Member Posts: 66
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

  • infidelinfidel Member Posts: 2,900
    : 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.
  • VB5begginnerVB5begginner Member Posts: 66
    alright thanks that was real easy
  • MalcolmMalcolm Member Posts: 828
    [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.




  • Shawn CarterShawn Carter Member Posts: 0

    _ ( http://forcoder.org ) free ebooks and video tutorials about < Delphi Java Perl Visual Basic C# PHP MATLAB Objective-C Swift C++ Ruby Assembly JavaScript R Visual Basic .NET Python PL/SQL C Scratch Go Erlang Scheme Prolog D ML Awk Clojure Transact-SQL ABAP SAS Crystal Scala LabVIEW Alice Bash COBOL Rust Lua F# Apex Julia Dart Fortran Logo FoxPro Kotlin VBScript Ada Hack Lisp /> ___________

Sign In or Register to comment.