Results 1 to 3 of 3

Thread: Need CreateObject Sample

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    7

    Smile

    I need sample code to Create an object and display it on a form. Also I need sample code for the object it self(A simple object).

    Thank you

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    [code]
    'add a command button to a form dynamically at run time
    'if you want to add properties use the same properties
    'as the command button

    Option Explicit

    Private WithEvents btnObj As CommandButton

    Private Sub btnObj_Click()
    MsgBox "Hello, this is a dynamically added button."
    End Sub

    Private Sub Form_Load()
    Set btnObj = Controls.Add("VB.CommandButton", "btnObj")
    With btnObj
    .Visible = True
    .Width = 3000
    .Caption = "This button was created on the fly!"
    .Top = 1000
    .Left = 1000
    End With
    End Sub

    [code]

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    7
    How about if I want to use my own control instead?

    Does my control need to have anything special to do this too?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width