Hi there, i am a novice coder and i'm trying to comprehend the addhandler function.
on my current form, i have two pictureboxes, that i am trying to use in an addhandler with a loop, so when they are highlighted, the sender will change image.
Public Class Form1
Dim i As Integer
Dim picturebox As PictureBox() = {PictureBox1, PictureBox2}
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
For Me.i = 0 To 1
AddHandler picturebox(i).MouseEnter, AddressOf highlight
Next
End Sub
Private Sub Rollover(sender As Object, highlight As System.EventArgs)
DirectCast(sender, PictureBox).ImageLocation = ("C:\Users\Steve _\Desktop\Untitle.png")
End Sub
End Class
I understand i am doing something wrong here, can someone assist and explain what i am doing wrong and how this could be corrected? Thanks