Results 1 to 10 of 10

Thread: how to add methods to activex control?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    shiraz
    Posts
    163

    how to add methods to activex control?

    Hi guys
    I’m developing an activex control and I want to add some methods to it. Any one knows how to do it? Or is it possible?
    Thank u very much

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    course its possible

    the methods are the public Sub procedures that you write for it.

    i.e.
    Public Sub DoStuff()
    MsgBox "Doing Stuff!"
    End Sub

    Then if you put the following code in a program that uses your OCX:

    InstanceOfYouOCX.DoStuff()

    NOTE: Methods are public!!! If you declare them with Dim or Private then they will only be available to the OCX itself, and not the forms etc that you create the instances on.

    Good fun making OCX's innit?
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    NOTE: "OCX" should really be replaced with "ActiveX Control", which is what you used .

    "OCX" is what they used to be called.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    shiraz
    Posts
    163
    thanks
    and where should i declare these subs? in a module or some event?

  5. #5
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228

    Cool what i usually do...

    WHat i usually do is i just set aside a spot for all the methods of
    that usercontrol and just place it there. So in the usercontrol's
    code just plop the methods.

    Do you need help learning how to do any other stuff with activex
    controls such as events, properties, etc?
    Luke

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    shiraz
    Posts
    163

    Re: what i usually do...

    Originally posted by macai
    WHat i usually do is i just set aside a spot for all the methods of
    that usercontrol and just place it there. So in the usercontrol's
    code just plop the methods.

    Do you need help learning how to do any other stuff with activex
    controls such as events, properties, etc?
    thanks alot my friends i know how to do these, i mean events,properties and stuff. but still i don no what do u mean by a putting aside a spot. do u mean a module or stuff?

  7. #7
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228

    Cool ill give an example

    Ill give a quick example.
    VB Code:
    1. 'My UserControl
    2. 'Ill put properties here
    3. Public Property Get MyProp()
    4.  MyProp = "MYPROP!"
    5. End Property
    6. 'I'll put methods here
    7. Public Sub MyMethod(Text As String)
    8.  MsgBox Text
    9. End Sub
    Catch my drift?
    Luke

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    shiraz
    Posts
    163

    Thumbs up Re: ill give an example

    I got it. thanks aloooot

  9. #9
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228

    Cool No problem.

    No problem, man. If you need more help, you can contact me

    AIM: Warlord Luke
    ICQ: 127514321
    Yahoo! Messenger: macai_wasati_legato
    E-Mail: [email protected]
    Luke

  10. #10
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    try searching in the COM and ActiveX part of the forum, you'll get a lot of answers and useful info there.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

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