473,320 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Main application object in vb.net

Is there a way to get a reference to the main application window object in
vb.net? Like an MDI app, I would like to get to the MDI Shell window.

Thanks,

Byron...
Nov 21 '05 #1
7 1933
if by Shell window, you mean the main form that is a Parent to all the
other child forms, you can do the following

'declare a local variable as your MDI parent form's class
Dim frmMainLcl As frmMain
'set the local variable to reference the child form's parent form
frmMainLcl = Me.MdiParent
'this line calls a Public sub routine in the MDI parent form from the
child form
frmMainLcl.updatestatusbar

Nov 21 '05 #2
Byron,

"Byron Hopp" <bh***@matrixcomputer.com> schrieb:
Is there a way to get a reference to the main application window object in
vb.net? Like an MDI app, I would like to get to the MDI Shell window.


For MDI children:

\\\
Dim Parent As MainForm = DirectCast(Me.MdiParent, MainForm)
Parent.StatusBar1.Text = "Hello World"
///

More general:

Providing a reference to an application's main form
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=accessmainform&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Is there a way to do this via the Framework, I am attempting to create some
generic functions usable by other applications.

Thanks,
Byron...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uN*************@TK2MSFTNGP15.phx.gbl...
Byron,

"Byron Hopp" <bh***@matrixcomputer.com> schrieb:
Is there a way to get a reference to the main application window object
in vb.net? Like an MDI app, I would like to get to the MDI Shell window.


For MDI children:

\\\
Dim Parent As MainForm = DirectCast(Me.MdiParent, MainForm)
Parent.StatusBar1.Text = "Hello World"
///

More general:

Providing a reference to an application's main form
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=accessmainform&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
What do you mean when you say "via the framework"? The methods posted
are done using the framework. What are you trying to accomplish?
Perhaps there is another method which will work.

Nov 21 '05 #5
Byron,

"Byron Hopp" <bh***@matrixcomputer.com> schrieb:
Is there a way to do this via the Framework, I am attempting to create
some generic functions usable by other applications.


What's not generic enough with using 'Me.MdiParent'? How would you expect
the solution to look like?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
Chris,

Im am trying to get this window without any knowledge of the existing
application, I don't want to have to write a special function in the app, or
have any knowledge of any child windows. Is there a function which will
return the main form without any parameters, or existing knowledge of the
running app?

Thanks,

Byron...

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
What do you mean when you say "via the framework"? The methods posted
are done using the framework. What are you trying to accomplish?
Perhaps there is another method which will work.

Nov 21 '05 #7
Byron,

"Byron Hopp" <bh***@matrixcomputer.com> schrieb:
Im am trying to get this window without any knowledge of the existing
application, I don't want to have to write a special function in the app,
or have any knowledge of any child windows. Is there a function which
will return the main form without any parameters, or existing knowledge of
the running app?


No. There is no general definition for "application's main form".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8

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

Similar topics

7
by: David Elliott | last post by:
I have created an application that will dynamically load other DLLs (plugins). The new plugin is a winform with an embedded IE Browser. I am wanting to have the form to run in its own thread....
1
by: Henry | last post by:
I was trying to work through the Lab 2 exercises in the Microsoft's Windows-Based Applications in Visual C#. While I am not showing any errors I am also not seeing the mainMenu object when I run...
1
by: BillZondlo | last post by:
Can someone look at this and tell me why, when I call this from my main app, it displays fine (fades form in and out) but then before my main app displays, I see other dialog boxes flash...
3
by: stumorgan | last post by:
There is probably an extremely simple answer to this question and I'm just being foolish. I have a main form (let's say FormMain) which opens other forms (let's say Form1, Form2). How do I keep...
4
by: Bob Day | last post by:
Using VS 2003, VB.Net, MSDE... The example below from help shows that the Sub Main contains an explicit Application.Run. Is this required? Are there pros and cons of doing it this way? I have...
4
by: Shaurya Vardhan | last post by:
Hi, I have to launch my Application after receiveing arguments from outside. And Sub Main has to be the start up object. Depending upon the Arguments, a for has to be launched. After I lauch...
8
by: koorb | last post by:
I am starting a program from a module with the Sub main procedure and I want it to display two forms for the program's interface, but when I run the program both forms just open and then program...
17
by: Fred Nelson | last post by:
Hi: I'm trying to implement an overall error handler in my VB.NET windows application. I need to place an "On Error Goto" in "Sub Main". I have tried to create a Sub Main and have had no...
12
by: Brian Shafer | last post by:
Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable...
5
by: Bob Altman | last post by:
Hi all, I have a WinForms app that has no main window (just a module with a Sub Main). My Main routine calls a subroutine that wants to politely abort the application rather than return to its...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.