Results 1 to 5 of 5

Thread: I want to... . Plz Help Me...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2001
    Posts
    21

    Question


    I want to add a costum event in a built in object in VB
    Like a form or another objects, how can i do this?

    suppose i have an object in
    a project in vb such as form. this form has
    some events like: Load, MouseMove, Keypress and lablabla...,
    now i want to add an event to these events.
    how can i ?

    THANX in advance

    ps: i'm interested in to know farther about this subject, plz inform me if there are documents relared to this subject.

    Golpesar

  2. #2
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    Here Is It::

    Event OnAdd(byval Result as long) 'The Arg Is Optional

    Dim Res as long

    Private Sub Form_Load()
    AddNums 10,10
    end sub

    private sub AddNums(a as long,b as long)
    Res=a+b
    RaiseEvent OnAdd(Res)
    end sub

    private sub Form_OnAdd(byval Result as long)
    msgbox Result
    end sub
    __________

    If You Want To Know More(Like Properties ) EMail me.

  3. #3
    Member
    Join Date
    Jul 1999
    Posts
    42
    I don't understand, in this code example the source and the destination of the message are the same. The form is sending a message to itself. Why should you do something like this?
    If there is an external event (outside of the form) that must fire an event on the form you must create an extra class that can fire events. Look up the WithEvents keyword and the Event statement in the VB help files.

  4. #4
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    You Can Have Events In The Class Modules Or The User Controls You Create. And Those Events Can Be Handled In Your Forms.

  5. #5
    Member
    Join Date
    Jul 1999
    Posts
    42
    Yes, that was I mean. You need a event source (control or another class) and an event destination such as a VB form. No offence but if you create sample code as you did, it is must clearer if I create a completly working code sample that can be with cut and paste directly injto VB. Thanks.

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