Hi All,

I am new to C#. Please need your help. I have a set of 3 buttons in form1 out of which when I click on any, that particular value of the button gets assigned to text field in form2. I have used below code:

Form1:-
private void Btn1_Click(object sender, EventArgs e)
        {
            Navigator.Forward(Views.Form2);
            Form2 frm = new Form2(Btn1.Text);
            frm.Show();
        }
private void Btn2_Click(object sender, EventArgs e)
        {
            Navigator.Forward(Views.Form2);
            Form2 frm = new Form2(Btn2.Text);
            frm.Show();
        }
private void Btn3_Click(object sender, EventArgs e)
        {
            Navigator.Forward(Views.Form2);
            Form2 frm = new Form2(Btn3.Text);
            frm.Show();
        }

Form2:-
public Form2(string BtnText)
        {
           InitializeComponent();
           TxtBox.Text = BtnText;

        }

Any help would be appreciated...Thanks in advance!

The below line in the Program.cs file:-

namespace SIC.BSP
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [MTAThread]
        static void Main()
        {
            Application.Run(new FormController()); ----- this line
        }
    }
}

Dear tinstaafl, Thank you very much for your time...I got it resolved. Thank You very much for your help!

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