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

x
?
Solved

passing information between forms?

Posted on 2004-09-24
6
Medium Priority
?
195 Views
Last Modified: 2010-08-05
how do i do this?
0
Comment
Question by:stromberg10
[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
6 Comments
 
LVL 1

Expert Comment

by:nikelsh
ID: 12141646
use property get and set .... in form.
0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12141760
create property with public prefix and do not free the form immidiatly then you can get the information like form.textbox1.text
0
 
LVL 2

Expert Comment

by:ahmadfuwad
ID: 12141806
by using form objects
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:iboutchkine
ID: 12142064
'Create a module CT.vb
'Create one shared property for each form
'This example has two forms(Form1 and From2)
Public Class CT
    'For cross talking between forms
    Private Shared m_From1 As From1
    Public Shared Property From1() As From1
        Get
            Return m_From1
        End Get
        Set(ByVal Value As From1)
            m_From1 = Value
        End Set
    End Property
    Private Shared m_Form2 As Form2
    Public Shared Property Form2() As Form2
        Get
            Return m_Form2
        End Get
        Set(ByVal Value As Form2)
            m_Form2 = Value
        End Set
    End Property
End Class

'To call Form2 from Form1
Dim myForm2 as new Form2

'Tell Form2 who to talk back to and open Form2
'You can also put code here to send to a Form2 control
        CT.Form1 = Me
        myForm2.Show()

'You can talk back from Form2 to this instance of Form1
'By putting code in From2 like...
      CT.Form1.Label1.Text = "Blah, Blah"
0
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 12142456
This article has all the necessary code with explanation you want
http://www.developerfusion.com/show/4375/9/

0
 
LVL 8

Accepted Solution

by:
wguerram earned 1000 total points
ID: 12143304
Declare the forms variable as public in a module:

Public Form1 as new form1
public Form2 as new form2

in your sub main

form1.Show

'From inside the form1

Form2.Show


Now from Form2 you can access Form1 via the public variable:

MsgBox Form1.txtName.Text

'--------------------

In order to access controls from both forms you have to change its Modifiers property to Public.

You can add public variables to the forms and also will be accessible, like:

Public MyVar as string.

'Example

Public Module1
        Public Form1 as new Form1
        Public Form2 as new Form2
End

Public Class Form1
     Public MyVar as string

End class

Public Class Form1
     Public MyVar2 as string

End class
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
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…

656 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