Solved

Accessing controls / subroutines between two forms...

Posted on 2004-09-23
5
132 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
5 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 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 250 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 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