Passing variables between classes

S

sabarad_arun

Hi All,

Please help me on this...

I have a form1 with some controls.When i select editcontrol on form1 it
opens up form2.I have some settings(variables) in form2.I make some
changes to the settings in form2.When i click on ok on the Form2,i
should be able to access the changed values from form1.I want to have
this without creating an object of form2 in form1.

Can anybody suggest me on this.
Thanks
Arun
 
K

Klatuu

Assuming Ok is a command button, put the code in the Click event of that
button to put the values in the controls on form 1.

forms!Form1!SomeControl = Me.MyForm2ControlNameHere
 
G

George Nicholson

(If I understand your question correctly, here is an outline of what you
want to do in code. This is obviously not real code...)

From button(?) on Form1:
Open Form2
DoWhileForm2.Visible = True
' Don't continue until Form2 is hidden
Do Events
Loop
Get settings from Form2 (which is now hidden)
Close Form2

In Form2:
Open & do whatever
CloseButton_Click: Me.Visible = False

The Visible property for a form won't appear in it's property sheet. It can
only be set via macro or code.

HTH,
 
S

sabarad_arun

Hi George,
I will explain my problem in detail.I have a SaveTo function in form1.I
have some variables in form2.I need to first get the default values of
these variables in form1 so that i can write these settings to a file
on the local disk.This is my first problem.

Secondly when i click a button in form1 it opens up form2.i make some
changes in these settings and click on OK on form2.Now when i click on
the OK button of form2 i need the latest settings in form1 so that i
can use the SaveTo function to save the latest settings to the file.

Can u help me on this George
Thanks,
Arun
 
Top