-
Say I have 2 diff't forms.
On frm1, There are 3 txt boxes (txt1,txt2,txt3)
1 cmd button (cmd1)
-the purpose of this form is to add txt1 + txt2, to get the result in txt3
On frm2 there is one txt box (txtA)
and one cmd button (cmdA)
The purpose of all this is for a user to input a number in txt1, have it added to what's already in txt2 to get txt3.
Txt2 should get it's info from whatever is set on frm2 txtA.
Frm2 txtA's number should always stay the same until a user goes in to change it. It should also remain after the user shuts down the program and restarts it again. Think of it as a "settings" form.
How exactly do I pull this off?
(I'm sorry if I made this more confusing than it had to be)
Thank You.
-
A few things to try
try...
txt2 = frm2.txtA
this will work if form 2 is not closed (it'll work if form 2 is hidden)
or you could try storing the value in txtA to a integer variable and using the variable. This variable will have ot be stored in a module (just add on from the menu )
'In module
Global temp as integer
...
'In form 2
temp = txtA
'In form 1
txt2 = temp
so that temp is updated every time the value of txtA is changed you could put in a txtA_data_changed fn.
Hope it helps.
H.
-
Use savesetting and getsetting to save your data to the registry
-
Hollie, thank you.
Mart, could you explain a little more? (I'm new)
Thank you
-
Marnitzg has the right idea. There's plenty of documentation for these commands in both the VB Help files and anywhere on the web (including this site; use the Search feature). These two commands will store a value in the user's Registry that can be altered and recovered at will. Here's the basics:
Code:
' Place some settings in the registry.
SaveSetting "MyApp","Startup", "Left", 50
'This will return the correct value (50)
iLeftSetting = GetSetting("MyApp", "Startup", "Left")
If this app will be running as a multi-user app with a central set of values for all users, you might think about creating an ini file to hold those values (again, do a Search here).