473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

pass the value in a textbox from form1 to the textbox in form3.

i hav 3 forms.After clicking a button on form1 it shows form2 n similarly after clicking form2 ,form3 appears.i want to hav the value in a textbox in form3 from a textbox in form1.
Jul 23 '08 #1
10 1989
r035198x
13,262 8TB
When the button on Form1 is clicked, pass the textbox's value to Form2 through Form2's constructor.
Jul 23 '08 #2
I know how to pass the value to Form2,which is directly called by Form1.
But i want to know how to pass value to Form3 which is not directly called by Form1.Form3 is called by Form2,and Form2 does not uses the value that is required by Form3(the value which is passed from form1 to form3).

Form1 has a button which on a click opens Form2 and Form2 also has a button which on click opens Form3.I want to pass the value in a textbox in Form1 to the textbox in Form3.The main problem is that Form3 is not directly called by Form1 in this case i want to know how to pass the values b/w these forms.
hope now my ques is clear.plzz give the solution.
Jul 23 '08 #3
bharathreddy
111 100+
hi,

The answer is already given by r035198x .

You pass the value from form1 to form2 and from form2 to form3.

Send the value through the form2s constructor and store the value in some global variable in form2 and when u call form3 send it to this constructor and thats done you got the value in form3.
Jul 23 '08 #4
Pass the value of textbox in the constructor while calling form2. store the value in a global variable inside form2, eventhough it is not used, and pass the value on form3 when calling it by using that variable as parameter for the constructor.
Jul 24 '08 #5
thanks its working.
.................................................. .................................................. ....
Jul 25 '08 #6
r035198x
13,262 8TB
thanks its working.
.................................................. .................................................. ....
Welcome. Reading a tutorial on how to use classes in C# will clarify further.
Jul 25 '08 #7
markmcgookin
648 Expert 512MB
Welcome. Reading a tutorial on how to use classes in C# will clarify further.
A static class is a nice way to do this.

i.e. - information.cs

then a public variable in there

get:{}
set:{}

methods for that value.

then when you call form 3 look for Information.myValue;
Jul 25 '08 #8
r035198x
13,262 8TB
A static class is a nice way to do this.

i.e. - information.cs

then a public variable in there

get:{}
set:{}

methods for that value.

then when you call form 3 look for Information.myValue;
If the variable is not required to be an instance variable by the design then that would also work. Many instance variables have made been made static incorrectly just to get at them as quickly as possible when writing code though.
Jul 25 '08 #9
joedeene
583 512MB
in VB couldnt you just do something like

Expand|Select|Wrap|Line Numbers
  1. private shared form1txtvalue as string 'or integer or whatever the value is
  2. 'and then set the value when the button is clicked
  3.  


and then in form3 just use

Expand|Select|Wrap|Line Numbers
  1. textbox1.text=form1txtvalue
wouldnt that work ?
Jul 25 '08 #10
TRScheel
638 Expert 512MB
in VB couldnt you just do something like

Expand|Select|Wrap|Line Numbers
  1. private shared form1txtvalue as string 'or integer or whatever the value is
  2. 'and then set the value when the button is clicked
  3.  


and then in form3 just use

Expand|Select|Wrap|Line Numbers
  1. textbox1.text=form1txtvalue
wouldnt that work ?

Only if the variable isn't changed before being requested. It should really be passed along through the stack if it can be.
Jul 25 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Omar Llanos | last post by:
Recently, I posted a question on how to invoke a textbox control in Form1 (parent form) from within Form2 (which is inherited from Form1). Someone suggested to pass a reference of the Form1 to the...
6
by: PradeepKel | last post by:
Hi, I have 3 forms in my application. Form1 which is a MDI form calling Form2 & Form3. Form2 has a textbox "TextBox1" and Form3 has a CommandButton "Button1". I will show both Form1 & Form2 as...
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
1
by: swatidesai0407 | last post by:
im working on php i want the textbox value to pass in a href it goes as this <input type="text" name="use"> <a href="new.php?cat=textbox value dat is entered"> plz tell me wat to do
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.