general question

Salat

Regular
Joined
Mar 5, 2002
Messages
81
Location
Poland, Silesia
How to comunicate between two or more existing Forms. It was simple in VB 6, but now, I realy don't know how to solve it. I've tried with module, which, loads all new forms, but when one, of them is closed by user, and the code is trying to recive some public type, the expection is generated.

I know there is, some very simple method to solve this problem... please help, I'm so fresh to VB. Net...
 
I don't get it? how? Maybe You didn't understand me, or You did, but I don't.

eg.
Form1 with button:
Code:
sub button_clicked
  dim f as new form2
  f.show
end sub
every time button is clicked a new form appear... but If I want to get some data form already existing form2... without creatnig completly new... how to do it?
 
Ah I see.
Events might be slightly over the top here.

Howbout this (This is PSEUDOCODE!)

Visual Basic:
Class frmMain 

  Private m_frmSub as frmSub = Nothing 'This is a private member variable

Sub Button_Click ()
  if m_frmSub is nothing then
    m_frmSub = new frmSub
    m_frmSub.show
End sub

Sub getData()
   Dim var as string
   var = m_frmSub.Text1.Text
end sub
end class
 
Back
Top