Hi all,
The Click event handler of a button control can be invoked using the
Button.PerformClick method. But I have a Picturebox, whose click event
handler I want to invoke. RaiseEvent doesn't seem to apply in this case. I
could set up a Custom method and call that method instead, but it would
require some recoding, so I was wondering if the Event can be raised
directly. (I vaguely recall a way to do this, but it's evading me right
now!)
Private Sub PicBox_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PicBox.Click
'My code here.
End Sub
How do I call this method, or raise the Click event for the PictureBox ?
Thanks in advance,
Regards,
Cerebrus. 3 7455
As long as the sender and e arguments are of no consequence to the piece of
magic contained in 'My code here., then you can simply call:
PicBox_Click(Nothing, Nothing)
A cleaner way to deal with it though, is to seperate the desired operation
from the event handler:
Private Sub PicBoxClickHandler()
'My code here.
End sub
The 'My code here. in PicBox_Click now becomes:
PicBoxClickHandler()
which can also be called quite cleanly from anywhere that can access the
procedure.
"Cerebrus99" <zo*****@sify.com> wrote in message
news:Oz**************@TK2MSFTNGP12.phx.gbl... Hi all,
The Click event handler of a button control can be invoked using the Button.PerformClick method. But I have a Picturebox, whose click event handler I want to invoke. RaiseEvent doesn't seem to apply in this case. I could set up a Custom method and call that method instead, but it would require some recoding, so I was wondering if the Event can be raised directly. (I vaguely recall a way to do this, but it's evading me right now!)
Private Sub PicBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PicBox.Click 'My code here. End Sub
How do I call this method, or raise the Click event for the PictureBox ?
Thanks in advance,
Regards,
Cerebrus.
Hi Stephany,
Thanks for your prompt response.
I tried PicBox_Click and it works fine. I was missing out something obvious
and was trying to call PicBox.Click(nothing, nothing). Didn't realize that I
should change it to PicBox_Click ! Thanks a lot.
Regards,
Cerebrus.
"Stephany Young" <noone@localhost> wrote in message
news:OZ*************@TK2MSFTNGP14.phx.gbl... As long as the sender and e arguments are of no consequence to the piece
of magic contained in 'My code here., then you can simply call:
PicBox_Click(Nothing, Nothing)
A cleaner way to deal with it though, is to seperate the desired operation from the event handler:
Private Sub PicBoxClickHandler() 'My code here. End sub
The 'My code here. in PicBox_Click now becomes:
PicBoxClickHandler()
which can also be called quite cleanly from anywhere that can access the procedure.
"Cerebrus99" <zo*****@sify.com> wrote in message news:Oz**************@TK2MSFTNGP12.phx.gbl... Hi all,
The Click event handler of a button control can be invoked using the Button.PerformClick method. But I have a Picturebox, whose click event handler I want to invoke. RaiseEvent doesn't seem to apply in this case.
I could set up a Custom method and call that method instead, but it would require some recoding, so I was wondering if the Event can be raised directly. (I vaguely recall a way to do this, but it's evading me right now!)
Private Sub PicBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PicBox.Click 'My code here. End Sub
How do I call this method, or raise the Click event for the PictureBox ?
Thanks in advance,
Regards,
Cerebrus.
"Stephany Young" <noone@localhost> schrieb: As long as the sender and e arguments are of no consequence to the piece of magic contained in 'My code here., then you can simply call:
PicBox_Click(Nothing, Nothing)
Avoid doing that! Instead, call 'PicBox_Click(Me.PixBox, EventArgs.Empty)'
or, even better, use a separate procedure (as you already described).
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: SStory |
last post by:
I have a picturebox in my About form.
would like to have a link to my company website. Wanted the links
background to be transparent.
It seems that no one knows how to do this.
Have asked...
|
by: akh |
last post by:
I want to use de Drag and Drop ´s event to move a picture box from a
form and within a Picture Box.
But I have behaviour if the MyPBox As PictureBox as the Globale
varible or not
Thanks for...
|
by: kalp suth via DotNetMonster.com |
last post by:
I want to create arrows using lines on a picture in the picture box.
On clicking the button "btnShowAll", the image is loaded and the lines drawn. "RGSShowAll()" calls "DrawObjs()" which does the...
|
by: Mattbooty |
last post by:
Hello,
Not sure if anyone else has seen this bug, but I have a form where
the entire form is covered with a picturebox. The picturebox has a
mouseup event. I also have an open file dialog for...
|
by: toby |
last post by:
Hi there,
Is it possible to create an array of picturebox controls during
run-time. I wish to create a new image/picturebox everytime a user
clicks the button on a form, and they need to be...
|
by: robusto33 |
last post by:
Hi everyone, I'm really new to C#.net development, especially for win32 applications. I'm basically making a board game and was wondering if anyone could help me out with this predicament:
I have...
|
by: munibe |
last post by:
Hi, i have a problem about picturebox control. if you may help me, i will be so happy. i have a picturebox named pic_map, and i added a button named customer_button, my wish is to add a new small...
|
by: Jim McGivney |
last post by:
In C# on Form1 I genetate an array of PictureBoxes and populate each with an
image as seen in the code below.
Later on I want to access a specific PictureBox to change its image, but I
keep...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |