M
Mugsy_in_Houston
Guest
I have a working program that displays a collection of icons which you can MouseOver to display a "magnified" (larger) copy.
I ran into an issue where the compiled version of program sometimes crashes but when executed from the VS Debugger, runs just fine. So I added Option Strict On & Option Explicit On to see if sloppy code was the cause. Doing so reavealed the following "error":
For intCnt = 0 To thumbnails.Count - 1 ' Add MouseOver support.
Me.Controls.Add(thumbnails(intCnt))
AddHandler _ thumbnails(intCnt).MouseHover, _
AddressOf Thumbnails_MouseHover
AddHandler thumbnails(intCnt).MouseLeave, _
AddressOf Thumbnails_MouseLeave ' <-- ERROR: Option Strict On does not allow
' narrowing in implicit type conversions between
' method 'Private Sub Thumbnails_MouseLeave()' and delegate 'Delegate Sub
' EventHandler(sender As Object, e As EventArgs)'.
Next
.
Why does "MouseHover" work but not "MouseLeave"? (If I swap the lines, the error sticks with that line so I know it's not just because it came second.)
I'm not sure how to fix this. Any ideas? Thx.
ADDENDUM: "thumbnails()" is of type "PictureBox".
Continue reading...
I ran into an issue where the compiled version of program sometimes crashes but when executed from the VS Debugger, runs just fine. So I added Option Strict On & Option Explicit On to see if sloppy code was the cause. Doing so reavealed the following "error":
For intCnt = 0 To thumbnails.Count - 1 ' Add MouseOver support.
Me.Controls.Add(thumbnails(intCnt))
AddHandler _ thumbnails(intCnt).MouseHover, _
AddressOf Thumbnails_MouseHover
AddHandler thumbnails(intCnt).MouseLeave, _
AddressOf Thumbnails_MouseLeave ' <-- ERROR: Option Strict On does not allow
' narrowing in implicit type conversions between
' method 'Private Sub Thumbnails_MouseLeave()' and delegate 'Delegate Sub
' EventHandler(sender As Object, e As EventArgs)'.
Next
.
Why does "MouseHover" work but not "MouseLeave"? (If I swap the lines, the error sticks with that line so I know it's not just because it came second.)
I'm not sure how to fix this. Any ideas? Thx.
ADDENDUM: "thumbnails()" is of type "PictureBox".
Continue reading...