Results 1 to 4 of 4

Thread: CreateObject

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    How can i use the createobject() function to create objects like buttons, textboxes etc ? and then to know when an event like text change has occured on the new textbox ?

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

    <?>

    Code:
    Option Explicit
    ' Remarks:
    ' Dynamically add a new button to the form. The
    ' item to add, a button in this case, must be a
    ' member of the VB object as displayed in the
    ' Object Browser.  The second parameter is the
    ' the new control's name.
    '
    Private WithEvents btnObj As CommandButton
    
    Private Sub btnObj_Click()
    '
    ' Respond to the new button's Click event.
    '
        MsgBox "This button was added at run time!"
    End Sub
    
    Private Sub cmdAdd_Click()
     
        Set btnObj = Controls.Add("VB.CommandButton", "btnObj")
        '
        With btnObj
            .Visible = True
            .Caption = "&Dynamically Added Button"
            .Top = 0
            .Left = 0
            .Width = 2400
            .Height = 500
        End With
    
    End Sub
    "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
    Addicted Member
    Join Date
    Jun 2000
    Posts
    175

    Re: <?>

    Hi,

    While you are at it could you please tell me hoe to create a Msword object?

    when I use CreateObject("Word.Application") I get runtime error 429

    Thanks
    Mass

  4. #4
    Addicted Member
    Join Date
    Jan 1999
    Posts
    204
    umm when i add that to a class like to make the object it dont work it saud the controls.add thing is not a vrable , but when i tested it on a button or somthing it worked , can you help me
    WHat would we do with out Microsoft.
    A lot more.

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