Question

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.

Was it helpful?

Solution

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.
        }
    }
}

OTHER TIPS

var otherForm = new Form2();
otherForm.ShowDialog(); // To show a modal dialog, or...
otherForm.Show();  // To show it as a non-modal window
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top