.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

how can i pass value one form to another form

Posted By: Naim Khan     Posted Date: February 18, 2009    Points:2   Category :Windows Application
Hello EvryOne,
Well tell me how can i pass txtbox value from one form to another form and it will be saved in MySql on save button_click(); in Windows Application and C#;
its urgent
Thanks in Advance
Naim Khan

Responses
Author: Amit Mehra             
Posted Date: February 18, 2009     Points: 5   

Hi Naim,
You can overload the constructor of the 2nd Form like this

public Form2(string Name)

Now on button click

Form2 form = new Form2(txtBox1.Text);
form.Show();

2nd Method

Declare property in FOrm1 and Access the value in Form2

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: susant             
Posted Date: February 18, 2009     Points: 5   

Hi Naim u can try in this ways also...

declare one variable in form1 like:
form1
-------------------
public int i;
i=your value;

in form2
-----------
public int j;
j=form1.i;

in this way also u can pass the value...

One more way like crete on class and declare one static varibale
and asign the value in form1 and use it in form2 but for this u have to creae object for both of the forms..

susant
Mumbai

Author: susant             
Posted Date: February 18, 2009     Points: 5   

Hi Naim u can try in this ways also...

declare one variable in form1 like:
form1
-------------------
public int i;
i=your value;

in form2
-----------
public int j;
j=form1.i;

in this way also u can pass the value...

One more way like crete on class and declare one static varibale
and asign the value in form1 and use it in form2 but for this u have to creae object for both of the forms..

susant
Mumbai

Author: Narayanan             
Posted Date: March 09, 2012     Points: 20   

Hi,
read a value from Database and Call into Form2 text Box.

Read a value from SQL Server :

Select * from table_name 


Call a Value from SQL server:
Check this link
www.csharptuts.net/ado-net-tutorial-for-beginners/



Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend