Results 1 to 4 of 4

Thread: Event handling on run-time objects

  1. #1

    Thread Starter
    Addicted Member Beengie's Avatar
    Join Date
    Nov 2003
    Location
    Central Valley, CA
    Posts
    243

    Event handling on run-time objects

    I have a form "frmShow" that I created at run-time.

    How do I use event handlers without being able to create the code in the form?
    BeengieHappy.Vaue = (SharksScore > OpponentsScore)

    Go Sharks!

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You can use the AddHandler statement to attach an event to an appropriate delegate sub.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    or this
    VB Code:
    1. WithEvents f As New Form()
    2.    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3.       f.Show()
    4.    End Sub
    5.  
    6.    Sub x(ByVal sender As Object, ByVal e As EventArgs) Handles f.Load
    7.       f.Text = "the quick brown monkey jumps over the lazy dog."
    8.    End Sub

  4. #4

    Thread Starter
    Addicted Member Beengie's Avatar
    Join Date
    Nov 2003
    Location
    Central Valley, CA
    Posts
    243
    Thank you both.
    BeengieHappy.Vaue = (SharksScore > OpponentsScore)

    Go Sharks!

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