Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Link Different Form?

I got great help in my first question n hopefully someone will tell me or refer me to an earlier question about this topic.

I want to link different forms like I click on a button on first one and it opens the second one.Basically I'm going to make a Menu for cellphone functions like SMS,CALL etc. so I want that If I click on call a new form opens asking for Number to call etc.


2 Answers

void SomeInitializationFunction() {
      button.Click += new System.EventHandler(buttonClick);
}

private void buttonClick(object sender, System.EventArgs e)
{
    using(GetNumberForm getNumberForm = new GetNumberForm())
    {
        if(DialogResult.OK == getNumberForm.ShowDialog())
        {
            string phoneNumber = getNumberForm.PhoneNumber;
            // do something with the user input.
        }
    }
}
like image 108
Chris Doggett Avatar answered Nov 26 '25 20:11

Chris Doggett


var otherForm = new Form2();
otherForm.ShowDialog(); // To show a modal dialog, or...
otherForm.Show();  // To show it as a non-modal window
like image 29
mmx Avatar answered Nov 26 '25 19:11

mmx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!