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!

What is your code doing that is wrong?

It throws a missing method exception:-( No idea why

what line throws the exception?

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.