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

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Pass TextBox Values into another form ComboBox in C#.net

Posted By:Narayanan       Posted Date: October 31, 2012    Points: 200    Category: C#    URL: http://www.dotnetspark.com  

Today ,we will discuss about Pass One control Value to another Form in C#.net.

      Create a Project in VS 2008.

·         Create Two Form .Form 1 and Form2.

·         Create TextBoxes and One Button on Form1.

·         Rename name the TextBox .Start with txt.

·         Create ComboBox on Form2.

Now , we will go to Our scenario.

Copy and Paste the following codes in Form 1 Code View Section

public static string[] textvalues;

  List<string> values = new List<string>();

        private void button1_Click(object sender, EventArgs e)


             foreach (Control con in this.Controls)


                if (con.Name.StartsWith("txt"))




   textvalues = values.ToArray();

           Form2 frm = new Form2();


Copy and Paste the following codes in Form 2 Code View Section

private void Form2_Load(object sender, EventArgs e)



            foreach (string str in Form1.textvalues)





Just Run the Application and Enter the values and click Button1 .

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

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