Method '<method>' cannot handle Event '<event>' because...
<color="firebrick">Method 'ntfHelpDesk_DoubleClick' cannot handle Event 'DoubleClick' because they do not have the same signature.</color>
Any help is appreciated.
<color="firebrick">Method 'ntfHelpDesk_DoubleClick' cannot handle Event 'DoubleClick' because they do not have the same signature.</color>
Any help is appreciated.
The event handler you assign to the DoubleClick event must be a standard EventHandler delegate, like this:
Public Delegate Sub EventHandler( _
ByVal sender As Object, _
ByVal e As EventArgs _
)
That is, your event handler must accept two parameters of these exact types, and must return no value (or return void, in C#). Did you check to make sure your event handler meets these requirements?
I mentioned before that I am usually an ASP.Net guy. So maybe that's problem #1 :)
Anyway, here is my sub that is giving me that error:Private Sub ntfHelpDesk_DoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ntfHelpDesk.DoubleClick
System.Diagnostics.Process.Start("C:\Program Files\Internet Explorer\IEXPLORE.EXE","http://www.msn.com")
End SubDo you think you can help?
Here is what my code ended up looking like:Private Sub ntfHelpDesk_DoubleClick (ByVal sender As Object, ByVal e As System.EventArgs) Handles ntfHelpDesk.DoubleClick
System.Diagnostics.Process.Start("C:\Program Files\Internet Explorer\IEXPLORE.EXE","http://www.msn.com")
End Sub
Thanks for all the help!
The DoubleClick event for a NotifyIcon control uses the EventHandler delegate, which only accepts an EventArgs object in its second parameter. You're passing a MouseEventArgs parameter, so the code won't compile. You'd think that if the parameter inherited from the base class, it would work, but that's not the way delegates work in .NET. Therefore, to get this to work, your code will have to match the EventHandler delegate exactly, and look like this:
Private Sub ntfHelpDesk_DoubleClick(ByVal sender As System.Object, ByVal e As EventArgs) Handles ntfHelpDesk.DoubleClick
System.Diagnostics.Process.Start("C:\Program Files\Internet Explorer\IEXPLORE.EXE","http://www.msn.com")
End Sub
That should make it at least compile (I can't vouch for your paths and all that, but the code should at least COMPILE now <g>.
Your best bet, if you're just getting started coding with Windows Forms, is to allow Visual Studio .NET to create the event handlers for you. That way, you're guaranteed that they provide the correct parameter signature!
System.Diagnostics.Process.Start(" http://www.msn.com")
Thanks for the response. I remembered how to get the proper properties by using the drop-down boxes in VS.Net.
Erik,
Thanks for the pointer. I have a config file that I read in their exact browser location unless they have more than one, and prefer to open this particular site in a specific browser. I just through in the path as example
;)
H
woohoo...way to be! :)
I did the same thing about 6-9 months ago...I originally started on just ASP.NET, but now, I'm about 85% WindowsForms and 15% WebForms :|