0

I have two forms as form1 and form2 in my project.in form1 it has textbox as txtid. I take n=txtid.text in from1.then how can I use the same value of n (got at form1) applicable at from2.

2
Contributors
7
Replies
11
Views
5 Years
Discussion Span
Last Post by AndreRet
0

Declare your "n" value in a module -

''In a module...
Dim n As String

''In Form1...
n = Text1.Text

''In Form2...
Text1.Text = n
0

please if can tel me how to add a module?.as example if I use the value of n as n=5 in form1,then what i want is in form2 also the value of n shold be equal to n=5.when I assign one value to n at form1 then that value of n should be same at form2.please help me to do that.

Edited by mahela

0

Click on Project-->Add module

Then add the code I gave you above for module, form 1 form 2 etc...

0

I did this way.
'in module
dim n as string

'in form1
private sub cmd1_click()
n=txt1.text
form2.show
endsub

'in form2
private sub cmd1_click()
txt1.text=n
endsub

but at form2 the value of n is not given as I assign n at form1.

0

My bad, sorry. When you declare variables in a module, you have o make it public...

In your module, change the following.

Public n As String

''Dim will only allow values within the module. Public will let you use it in ALL forms and modules.
0

thank you very much friend.great help.thank you again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.