473,847 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FindFormForMenu Item

I can't figure out how to find the Form for a MenuItem is on using a reference to the
MenuItem only? I'm looking for something like the FindForm method for controls. I
finally figured out how do do it for components (see below), but I can't figure out
how to do something similar for menu items. Any ideas?

Thanks in Advance - JackRazz
Public Shared Function FindFormForComp onent(ByVal component As
System.Componen tModel.Componen t) As Form
Dim i As Integer
Dim container As System.Componen tModel.IContain er = component.Site. Container
Dim components As System.Componen tModel.Componen tCollection =
component.Site. Container.Compo nents
For i = 0 To components.Coun t - 1
component = CType(component s.Item(i), Component)
Dim parentForm As Form
If TypeOf component Is Form Then
Return CType(component , Form)
End If
Next
End Function

Nov 20 '05 #1
8 1156
"JackRazz" <Ja******@NotVa lid.com> schrieb
I can't figure out how to find the Form for a MenuItem is on using a
reference to the MenuItem only? I'm looking for something like the
FindForm method for controls. I finally figured out how do do it for
components (see below), but I can't figure out how to do something
similar for menu items. Any ideas?

AFAIS it is not possible. Why do you need it? Maybe you could raise an event
handled by the Form instead? BTW, a menuItem *is* a component.
Please post only to the appropriate groups next time.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
* "JackRazz" <Ja******@NotVa lid.com> scripsit:
I can't figure out how to find the Form for a MenuItem is on using a reference to the
MenuItem only?


Try this: 'MenuItem1.GetM ainMenu().GetFo rm()'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> schrieb
* "JackRazz" <Ja******@NotVa lid.com> scripsit:
I can't figure out how to find the Form for a MenuItem is on using
a reference to the MenuItem only?


Try this: 'MenuItem1.GetM ainMenu().GetFo rm()'.


*argh*

was seraching the props only...
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
* "Armin Zingler" <az*******@free net.de> scripsit:
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> schrieb
* "JackRazz" <Ja******@NotVa lid.com> scripsit:
I can't figure out how to find the Form for a MenuItem is on using
a reference to the MenuItem only?


Try this: 'MenuItem1.GetM ainMenu().GetFo rm()'.


*argh*

was seraching the props only...


I looked for 'FindForm' on the 'MainMenu' and I didn't find it. Then I
scrolled through the list and saw 'GetForm'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
Thats the ticket. It turned out to be quite simple. Thanks for the answer.

Regards - JackRazz

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:c6******** ****@ID-208219.news.uni-berlin.de...
| * "JackRazz" <Ja******@NotVa lid.com> scripsit:
| > I can't figure out how to find the Form for a MenuItem is on using a reference to
the
| > MenuItem only?
|
| Try this: 'MenuItem1.GetM ainMenu().GetFo rm()'.
|
| --
| Herfried K. Wagner [MVP]
| <URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
* "JackRazz" <Ja******@NotVa lid.com> scripsit:
Thats the ticket. It turned out to be quite simple. Thanks for the answer.


Thanks for confirming that it worked :-).

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

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:c6******** ****@ID-208219.news.uni-berlin.de...
| * "JackRazz" <Ja******@NotVa lid.com> scripsit:
| > Thats the ticket. It turned out to be quite simple. Thanks for the answer.
|
| Thanks for confirming that it worked :-).
|
| --
| Herfried K. Wagner [MVP]
| <URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
Ok, case closed.

JackRazz

Dim s As String = MainMenu1.GetFo rm.Name


"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:c6******** ****@ID-208219.news.uni-berlin.de...
| * "JackRazz" <Ja******@NotVa lid.com> scripsit:
| > Thats the ticket. It turned out to be quite simple. Thanks for the answer.
|
| Thanks for confirming that it worked :-).
|
| --
| 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

1
1105
by: JackRazz | last post by:
I can't figure out how to find the Form for a MenuItem is on using a reference to the MenuItem only? I'm looking for something like the FindForm method for controls. I finally figured out how do do it for components (see below), but I can't figure out how to do something similar for menu items. Any ideas? Thanks in Advance - JackRazz Public Shared Function FindFormForComponent(ByVal component As System.ComponentModel.Component) As...
4
1292
by: JackRazz | last post by:
Is there a way to get a components parent form from within the component? Thanks - JackRazz
0
9889
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
10987
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
10652
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
10709
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
9486
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5914
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4535
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 we have to send another system
2
4125
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3166
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.