472,358 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

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 1056
"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
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
by: JackRazz | last post by:
Is there a way to get a components parent form from within the component? Thanks - JackRazz
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

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.