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.

Declare your "n" value in a module -

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

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

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

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 4 Years Ago by mahela

Click on Project-->Add module

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

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

'in form1
private sub cmd1_click()

'in form2
private sub cmd1_click()

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

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.

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

This question has already been answered. Start a new discussion instead.