Results 1 to 2 of 2

Thread: EventHandler and passing value - Possible?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    EventHandler and passing value - Possible?

    I am dynamically adding sub items via the registry to my main menu with code. I need to be able to pass a value from the EventHandler to the sub OpenURL_Click. Is this possible and if so, how???

    Private Sub FillLinks()
    Dim ValueName As String
    Dim ValueArry As Array

    ValueArry = Splash.linkKey.GetValueNames()

    For Each ValueName In ValueArry
    mnuLinks.MenuItems.Add(ValueName, New EventHandler(AddressOf OpenURL_Click))
    Next
    End Sub

    Private Sub OpenURL_Click(ByVal sender As Object, ByVal e As EventArgs)
    MessageBox.Show(e)
    End Sub

    Thanks in advance!

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    No. And there is no reason to. You are not calling the event with EventHandler, just creating a link to what procedure to call when the event is fired.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

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