Results 1 to 3 of 3

Thread: events in interface definition ...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Location
    Mangalore ,India
    Posts
    22

    Red face events in interface definition ...

    hi all the genius out there ...,
    i am trying to develop a report engine like crystal report (something better ) ...for that i need to define a interface which has events .so that all the classes which implement this interface will also define the events ...i felt this is how the code should go ..

    'interface interface1 ( i call this class interface1)
    public event event1()

    public function func1()

    end function

    'a class which implements this interface should be like this(I feel) ..

    implements interface1

    public event interface1_event1()

    public function interface1_func1()
    'some lines
    'under some condition raise event1
    end function

    but this doesn't work because a event name cannot have a underscore .How to do this ?...
    I want the events raised by this class which implements the interface to be recieved when the object is referenced through the interface (interface1) .
    i.e
    dim ob1 as Interface1
    set ob1 = new class1 (the class which implements interface1)
    'this above line would give a runtime error ...

    ob1.func1() 'this would fire the event ...

    'the event code
    private sub ob1_event1()


    end sub
    'but this event cannot be recieved ..



    i wish i could explain it better ...
    do u have any solution or work arounds ...
    sudhir shetty .

  2. #2
    Hyperactive Member Anglo Saxon's Avatar
    Join Date
    Mar 2002
    Location
    Durham, UK
    Posts
    259
    Hmmm... if I understand you correctly, unfortunately because of VB's lack of 'true inheritance', you cannot do what you want, however, there are workarounds, read this article :

    http://www.devx.com/premier/mgznarch...400/pc0400.asp


    --
    AS

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Location
    Mangalore ,India
    Posts
    22
    Hi Saxon,
    it's really nice of u to take so much of effort to answer this question with pasted links ...
    .It served my purpose completely ...
    thanks and thanks a lot ...
    bye
    sudhir shetty .

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