Howdy, Stranger!

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

Categories

How to create control at runtime on form???

lee_slee_s Member Posts: 116
I want to build an ActivX dll that will create it's form at run time.
for ex.
num as integer
num = 4

i want to create 4 labels or some thing else on the form.

Comments

  • BarkeeperBarkeeper Member Posts: 335
    : I want to build an ActivX dll that will create it's form at run time.
    : for ex.
    : num as integer
    : num = 4
    :
    : i want to create 4 labels or some thing else on the form.
    :
    :

    Check out the MSDN for the Add-Function of the Controls-Collection of a form
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • lee_slee_s Member Posts: 116
    : : I want to build an ActivX dll that will create it's form at run time.
    : : for ex.
    : : num as integer
    : : num = 4
    : :
    : : i want to create 4 labels or some thing else on the form.
    : :
    : :
    :
    : Check out the MSDN for the Add-Function of the Controls-Collection of a form
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :
    :
    i dont find it in the msdn.
    Can you write me a simple sample code???
    Thanks
  • DarQDarQ Member Posts: 1,625
    Then look again. If a coder can't handle the MSDN, he should learn to handle the MSDN. Dont ask me about adding controls at runtime because i just dont know!

    : : : I want to build an ActivX dll that will create it's form at run time.
    : : : for ex.
    : : : num as integer
    : : : num = 4
    : : :
    : : : i want to create 4 labels or some thing else on the form.
    : : :
    : : :
    : :
    : : Check out the MSDN for the Add-Function of the Controls-Collection of a form
    : : ------------------------------------------
    : : Only stupidity of mankind and the universe
    : : are infinite, but i'm not sure concerning
    : : the universe. A. Einstein
    : :
    : :
    : i dont find it in the msdn.
    : Can you write me a simple sample code???
    : Thanks
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

  • MalcolmMalcolm Member Posts: 828
    : I want to build an ActivX dll that will create it's form at run time.
    : for ex.
    : num as integer
    : num = 4
    :
    : i want to create 4 labels or some thing else on the form.
    :
    :

    The best way to add controls at runtime is to put a control on your form at design time, give it an index value of 0, and then use the following code to load a new control:

    [code]Load Label1(1)
    Label1(1).Left = 100
    Label1(1).Top = 100
    Label1(1).Width = 1000
    Label1(1).height = 1000
    Label1(1).Visible = True[/code]

    If you have VB6 you could use the Add method of the Controls collection, but there is really no point. It gives no advantages over doing it this way, and is harder to implement.
  • BarkeeperBarkeeper Member Posts: 335
    : : I want to build an ActivX dll that will create it's form at run time.
    : : for ex.
    : : num as integer
    : : num = 4
    : :
    : : i want to create 4 labels or some thing else on the form.
    : :
    : :
    :
    : The best way to add controls at runtime is to put a control on your form at design time, give it an index value of 0, and then use the following code to load a new control:
    :
    : [code]Load Label1(1)
    : Label1(1).Left = 100
    : Label1(1).Top = 100
    : Label1(1).Width = 1000
    : Label1(1).height = 1000
    : Label1(1).Visible = True[/code]
    :
    : If you have VB6 you could use the Add method of the Controls collection, but there is really no point. It gives no advantages over doing it this way, and is harder to implement.
    :

    except that you don't have to fill up your form with invisible Controls at design-time.

    [code]
    Private WithEvents Text1 As VB.TextBox

    Private Sub Form_Load()
    Set Text1 = Controls.Add("VB.TextBox", "Text1")


    Text1.Visible = True
    Text1.Top=100
    Text1.Left=100
    Text1.Height=400
    Text1.Width=1000
    Text1.Text = "Dynamicly created Textbox"

    End Sub
    [/code]
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • Andre YoungAndre Young USAMember Posts: 0

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

Sign In or Register to comment.