[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Get a reference to the start up form

Posted on 2010-08-12
4
Medium Priority
?
388 Views
Last Modified: 2013-11-26
I am currently creating and MDI application with vb.net in VS2010.  I would like be able to reference the main start up form in sub windows without having to pass the referencein the constructor or some other method.

Since the main form is also the StartUp Form i was hoping there might be a way to get a reference to that form from the application object.

Does anyone know if there is a way to do this?

Thanks in advance..
0
Comment
Question by:MRS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:NormanMaina
ID: 33423762
IN VB 2008

FrmChild.MdiParent=me 'thats if you are referncing if from a menu's click event.
FrmChild.show

or

Woeks in VB 2005

Dim frm as new frmChild
frm.MdiParent=me
frm.show
0
 

Author Comment

by:MRS
ID: 33423838
i was looking for something a little more global then that.  Through the course of the application i may need to reference that main form (start up form) from windows that aren't neccessarily child windows.

For instance if i open a dialog window.  For the time being i wrote this, i was hoping for a more elegant solution.
   Public Function GetMainForm() As frmMain
        Try
            For Each frm As Form In My.Application.OpenForms
                If frm.GetType Is frmMain.GetType Then
                    Return frm
                End If
            Next
        Catch ex As Exception
            Throw
        End Try
    End Function

Open in new window

0
 
LVL 12

Accepted Solution

by:
NormanMaina earned 2000 total points
ID: 33423897
in vb 2008 all you need to do is call the form dicrectly from any other form.

ie frmmain.text="Success"
0
 

Author Closing Comment

by:MRS
ID: 33423908
I never knew that... Well that was easy... :-)
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question