473,503 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simulating menu clicks

I've either completely forgotten how to do this or it's different in
VB.Net from VB6, but how do I call the routine for a menu click
programmatically? (ie I want to simulate and call mnuTest_click). I
don't know what arguments to supply in the call.

TIA
John Dann
Nov 20 '05 #1
8 1941
Hi John,

You only have to call the event method that does the mnuTest_Click and
because you have to give the arguments is the most simple for that

mnuTest_Click(Nothing,Nothing)

(There are more methods so probably you get 4 others as well, this is the
most simple one in my opinion)

Cor
I've either completely forgotten how to do this or it's different in
VB.Net from VB6, but how do I call the routine for a menu click
programmatically? (ie I want to simulate and call mnuTest_click). I
don't know what arguments to supply in the call.

TIA
John Dann

Nov 20 '05 #2
Cor,

* "Cor Ligthert" <no**********@planet.nl> scripsit:
You only have to call the event method that does the mnuTest_Click and
because you have to give the arguments is the most simple for that

mnuTest_Click(Nothing,Nothing)

(There are more methods so probably you get 4 others as well, this is the
most simple one in my opinion)


Mhm... What if I want to get the reference to the item in the 'sender'
parameter of the handler? Passing 'Nothing' to the handler is IMO not
the best idea.

Just my 2 Euro cents...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
* John Dann <ne**@prodata.co.uk> scripsit:
I've either completely forgotten how to do this or it's different in
VB.Net from VB6, but how do I call the routine for a menu click
programmatically? (ie I want to simulate and call mnuTest_click). I
don't know what arguments to supply in the call.


Call the 'MenuItem''s 'PerformClick' method.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
Herfried,
You only have to call the event method that does the mnuTest_Click and
because you have to give the arguments is the most simple for that

mnuTest_Click(Nothing,Nothing)

(There are more methods so probably you get 4 others as well, this is the most simple one in my opinion)


Mhm... What if I want to get the reference to the item in the 'sender'
parameter of the handler? Passing 'Nothing' to the handler is IMO not
the best idea.


With the menu item for a newbie in VBNet? Before he can use the sender
object from the menu item he is already that far that he knows how to do it
with other objects, and the eventargument from the *click* event is not the
one that I have ever used.

However I did not say it was the best method, I said the most simple and
special in this case I think.

:-)

Cor
Nov 20 '05 #5
Herfried,

Then just send a reference to the control you want to use as the sender.

You can also create an instance of the event args and populate them if you
want to.

Then the event method won't be able to tell if the event was fired from
inside the control or created within your application.

-Sam Matzen
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e3**************@tk2msftngp13.phx.gbl...
Cor,

* "Cor Ligthert" <no**********@planet.nl> scripsit:
You only have to call the event method that does the mnuTest_Click and
because you have to give the arguments is the most simple for that

mnuTest_Click(Nothing,Nothing)

(There are more methods so probably you get 4 others as well, this is the most simple one in my opinion)


Mhm... What if I want to get the reference to the item in the 'sender'
parameter of the handler? Passing 'Nothing' to the handler is IMO not
the best idea.

Just my 2 Euro cents...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #6
* "Samuel L Matzen" <sm*****@slm.com> scripsit:
Then just send a reference to the control you want to use as the sender.

You can also create an instance of the event args and populate them if you
want to.

Then the event method won't be able to tell if the event was fired from
inside the control or created within your application.


ACK, but then I would use 'PerformClick' instead ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7
Herfried,

Selective answering?
* "Samuel L Matzen" <sm*****@slm.com> scripsit:
Then just send a reference to the control you want to use as the sender.

You can also create an instance of the event args and populate them if you want to.

Then the event method won't be able to tell if the event was fired from
inside the control or created within your application.


ACK, but then I would use 'PerformClick' instead ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #8
Cor,

* "Cor Ligthert" <no**********@planet.nl> scripsit:
Selective answering?


???

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1649
by: Pedro Sebastiao | last post by:
I need in urgence a program that simulates multiple mouse clicks in a windows xp application. I would appreciate if someone could send it to me. pedro.sebastiao@iol.pt
3
32913
by: Anand Ganesh | last post by:
Hi All, When the user right clicks on the desktop or selects a file and right clicks the mouse he should see our own submenu along with the Windows context menu. How will I do this in Visual C#...
0
919
by: Mojtaba Faridzad | last post by:
Hi, I have two menu groups; MainMenu and EditMenu. MainMenu includes: New, Edit, Delete, ... and EditMenu includes: Save and Cancel. the current menu is MainMenu. when user clicks on New menu,...
1
2755
by: Ignacio X. Domínguez | last post by:
Hi everyone. Hope you can help me out on this one. I'm developing a Component which has a property ContextMenu. This component, when placed on a form with a working ContextMenu (events assigned...
0
1233
by: Andrew Teece | last post by:
HELP! I am calling a webservice as a result of an event in an infragistics control (well, various controls). Problem is that if a user clicks around the GUI alot, then my code crashes (because...
2
1421
by: Paul E Collins | last post by:
A context menu is created in the scope of the RightClick event, but it continues to be displayed after that event handler terminates - i.e. after it has gone out of scope. The code works correctly,...
1
5240
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Hi, friends, I am using C#.net 2005 to create a windows application. It has menu items, such as File, etc. Under File, there are more menu items, such as New Files, Working Files, etc. Under...
21
2355
by: daydream | last post by:
yeah i need some help(such a common line) ,i have a menu and each link has its own div respectively and yeah obviously when u click the link the div shows, the problem is i would like each div to...
1
2163
by: Mike | last post by:
Here is my scenario. I just took over an existing asp site that is using a treeview menu on the pages. The treeview is an include file that is an include that is on every page. The issue is, when...
0
7199
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
7322
jinu1996
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...
1
6982
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...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.