473,654 Members | 2,990 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
programmaticall y? (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 1956
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(N othing,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
programmaticall y? (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**********@p lanet.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(N othing,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.c o.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
programmaticall y? (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(N othing,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******** ******@tk2msftn gp13.phx.gbl...
Cor,

* "Cor Ligthert" <no**********@p lanet.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(N othing,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.co m> 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.co m> 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**********@p lanet.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
1655
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
32925
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# ? Any suggestions please? Thanks for your time
0
922
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, I change the menu to EditMenu. when user clicks on Save or Cancel, I change the menu back to MainMenu. the problem : after exiting the EditMenu, when MainMenu appears, New is highlighted!!! C# keeps the highlighted on New and doesn't go away by...
1
2766
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 to elements and proven to work with labels) displays an icon in the notification area by calling ShellNotifyIcon() (don't want to use NotifyIcon class). The form's ContextMenu is assigned to the property ContextMenu of the Component. I'm able to...
0
1243
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 treeviews are cleared, etc).... If their clicks make the code work synchronously, evertything is fine, it would catch up with itself. The problem is that as soon as a webservice call is made, the system seems to perform a doevents, i say this...
2
1428
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, but I feel a bit odd about it. Is there anything to watch out for here? By the way, the reason I'm creating the menu dynamically every time is that the menu's contents and enabled-states can change based on what the user does, and I don't want...
1
5250
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 New Files/Working Files, there are more sub menu items, respectively. All those menu items are enabled at beginning.
21
2382
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 show no matter how many times you click the link for it and if you click on another one and when u go back to the original , the div would still show. at the moment i have partially done that, i click on item a ,that shows then when i click item b that...
1
2172
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 the user clicks on a menu option it opens a new page (menu is still there) and the menu is collapsed. example: menu looks something like this Menu1 Menu2
0
8375
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.