?
Solved

passing information between forms?

Posted on 2004-09-24
6
Medium Priority
?
193 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

801 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