473,509 Members | 3,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FindFormForMenuItem

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 Form
Dim i As Integer
Dim container As System.ComponentModel.IContainer = component.Site.Container
Dim components As System.ComponentModel.ComponentCollection =
component.Site.Container.Components
For i = 0 To components.Count - 1
component = CType(components.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 1140
"JackRazz" <Ja******@NotValid.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******@NotValid.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.GetMainMenu().GetForm()'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
* "JackRazz" <Ja******@NotValid.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.GetMainMenu().GetForm()'.


*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*******@freenet.de> scripsit:
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
* "JackRazz" <Ja******@NotValid.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.GetMainMenu().GetForm()'.


*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******@NotValid.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.GetMainMenu().GetForm()'.
|
| --
| Herfried K. Wagner [MVP]
| <URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
* "JackRazz" <Ja******@NotValid.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******@NotValid.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.GetForm.Name


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
| * "JackRazz" <Ja******@NotValid.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
1094
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...
4
1268
by: JackRazz | last post by:
Is there a way to get a components parent form from within the component? Thanks - JackRazz
0
7137
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
7347
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,...
1
7073
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
7506
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...
1
5062
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...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1571
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
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
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.