|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can anyone tell me a way to pass the text viariable of a textbox, named textBox1, in a form named Form1, to a textbox named textBox1 in form named Form2??
please Help... |
|
#2
|
|||
|
|||
|
Are those forms in the same page?
If not, and you submit first form to a new webform, you could assign the form element to the second form element in the page_unload sub
__________________
- Rogier Doekes |
|
#3
|
|||
|
|||
|
Ok, so you are having trouble passing info from one form to the next.
I love how OO programming brings in that extra level of protection. You just need to modify the access level of textBox1 in Form2 to 'protected internal'. The code to pass the information over is: Code:
Form2 f2 = new Form2(); f2.Show(); f2.textBox1.Text = textBox1.Text;
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#4
|
|||
|
|||
|
BTW, the above code assumes you are writing code for an event of a control that is in Form1 and Form1 has a textbox named textBox1.
|
|
#5
|
|||
|
|||
|
You also may add a module to your project and declare all the variables that you want passed from form to form as Public in that module. That way you can call it anytime.
|
|
#6
|
|||
|
|||
|
Quote:
I am trying to do something similar, how would I create a "module" and have global variables, that can be accessed from all forms in a solution? |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > c# windows Forms variables passing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|