473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

VB .NET Picturebox events... frustrating :(

sgeklor
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:

Expand|Select|Wrap|Line Numbers
  1. Dim ctrl_pb = New PictureBox
  2. ctrl_pb.Location = New Point(5,5)
  3. ctrl_pb.Visible = True
  4. ctrl_pb.SizeMode = PictureBoxSizeMode.AutoSize
  5. ctrl_pb.Name = "MyPictureBox"
  6. ctrl_pb.Image = MyProgram.My.Resources.ImageForPictureBox
  7. AddHandler (ctrl_pb.MouseEnter), AddressOf point_list_mouseover
  8. AddHandler (ctrl_pb.MouseLeave), AddressOf point_list_mouseout
  9. TargetPanel.Controls.Add(ctrl_pb)
  10. ctrl_pb = Nothing
Lines #7 and #8 are the ones giving the error: "'MouseEnter' is not an event of 'Object'." and "'MouseLeave' is not an event of 'Object'." respectively.
Oct 16 '07 #1
2 1320
kenobewan
4,871 Expert 4TB
Here is an article that may help:
Class to create a picturebox with events
Oct 16 '07 #2
Plater
7,872 Expert 4TB
What is "TargetPanel"? Is this a web or windows application?

I was able to create a picturebox and add events at runtime just fine?
Oct 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Stephen Williams | last post by:
I am migrating a VB 6 PictureBox control to VB.NET. In VB 6, this control modified its border style during the mouse down and up events to provide user feedback that it was selected. Once...
0
by: Stephen Williams | last post by:
Does Microsoft have a comment the possible bug on the PictureBox Class. Here is the exchange I had on the Experts-Exchange regarding this issue: From Z_Beeblebrox: Hi, I believe it is...
0
by: 6tc1 | last post by:
Hi all, I've got a UserControl that contains a few PictureBox objects. If I click on outside of the Picture in the UserControl, the scrolling with the mouse button works - however, no amount of...
2
by: active | last post by:
Problem: The PictureBox display appears to have the image cut off. I.e., the image bottom does not display although the PictureBox has room for it. It occurred to me that what was displayed was...
0
by: Pucara | last post by:
Hi all, I have noticed that the picturebox object doesnt' fire correctly the mouseEnter mouseLeave events. The problem is seen ONLY when you show a form more than once. You can reproduce it...
5
by: BrianW | last post by:
I am working on a program that has multiple picturebox controls that a user is allowed to move around which are contained within a panel control for visual placement. In my mousedown event, I set...
8
by: Ryan Chavez | last post by:
Hello, I'm working on a project that basically draws lines onto a PictureBox control. Now I'm using a Timer with an interval of 100 to draw the information. Now my code looks something like this:...
4
by: Jerry West | last post by:
I have a routine that updates a PictureBox image every x seconds. I do this by first loading an array with the path to all of the images. I then generate a random number to use as the index of the...
0
by: =?Utf-8?B?RG9jdG9y?= | last post by:
I am making an application that streams video from a web camera onto the client area of a PictureBox on a Windows CLR Form in MS Visual Studio 2005 (using C++). The streaming video works fine, and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.