Hi Guys,
I am trying to add some event handlers to my picturebox object which I am creating at runtime. The compiler (Visual Studio 2005) is flagging the code and telling me that the object does not have the events I am using. The code works fine for labels, just not for this picture box. Where have I gone wrong? :(
Here is my code:
Lines #7 and #8 are the ones giving the error: "'MouseEnte r' is not an event of 'Object'." and "'MouseLeav e' is not an event of 'Object'." respectively.
I am trying to add some event handlers to my picturebox object which I am creating at runtime. The compiler (Visual Studio 2005) is flagging the code and telling me that the object does not have the events I am using. The code works fine for labels, just not for this picture box. Where have I gone wrong? :(
Here is my code:
Code:
Dim ctrl_pb = New PictureBox ctrl_pb.Location = New Point(5,5) ctrl_pb.Visible = True ctrl_pb.SizeMode = PictureBoxSizeMode.AutoSize ctrl_pb.Name = "MyPictureBox" ctrl_pb.Image = MyProgram.My.Resources.ImageForPictureBox AddHandler (ctrl_pb.MouseEnter), AddressOf point_list_mouseover AddHandler (ctrl_pb.MouseLeave), AddressOf point_list_mouseout TargetPanel.Controls.Add(ctrl_pb) ctrl_pb = Nothing
Comment