Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing controls / subroutines between two forms...

Posted on 2004-09-23
5
Medium Priority
?
136 Views
Last Modified: 2010-04-23
I have a SubMain located in a seperate module.

I have a startup splash page thats loaded as a .showdialog.

I have a device I'm controlling and placing the status of this device on the splash page.

if that device status changes, while on the splash page, I want to update it with the new status...

so a module would need to access an already displayed form that it didn't directly call...

I'd really appreciate any help I could get....

          - Jayson
0
Comment
Question by:Mr_ComputerTech
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 12137699
Make your module look something like this:

    Module Module1

        Public mySplash As mySplashFormName

        Public Sub main()
            mySplash = New mySplashFormName
            mySplash.ShowDialog()
        End Sub

    End Module

Since mySplash is declared as Public in a module, it can be accessed from anywhere.

Regards,

Idle_Mind
0
 
LVL 18

Assisted Solution

by:DotNetLover_Baan
DotNetLover_Baan earned 1000 total points
ID: 12140075
Declare all the Forms as "Public" in the module. Create object with "New" keyword.

    Module Module1

        Public F1 As New Form1()
        Public F2 As New Form2()
        Public F3 As New Form3()

        Public Sub main()
            F1.ShowDialog()
        End Sub

    End Module
======================
Now make the Subroutines you want to access, "Friend" or "Public" . Select the controls you want to access, go to the properties, set the "Modifiers" property to "Friend" or "Public".
Now you can access them from any other form you want.

-Baan
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

876 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