I have two Windows forms. Form1 has a button which, when clicked on, opens up Form2 (which looks like a drop down/combobox type of control). Form2 is a grid of buttons that look like a telephone keypad. When one of these buttons is clicked on, Form2 closes and the text that was on the button clicked should be set to the text of the button in Form1. Anyone have any idea how I can do this? I've tried some code samples that sends text from a textbox from one form to another, but nothings working for the buttons I'm using. Form2 closes as it should when one of it's buttons is clicked... I just can't figure out how to send that buttons text to Form1's button's text.

Look, As far I got your scenario, Form2 may have property Number which holds the numbers user enters.
Before closing the Form2 From Form1, read the Form2.Number.

Here's a screen capture of what I've got to give a better idea of what it is I'm trying to do. No textboxes are involved at all. Only buttons and the text on those buttons. The "telephone keypad" is my Form2, which "pops up" (or, "drops down", as it appears to do in my app) when the "?" button on my Form1 is clicked on. Form2 has no titlebar or border to give it the appearance of a "drop down" control. When one of the number buttons on Form2 is clicked on, the keypad (Form2) closes, but whatever key is clicked on, that number, "*" or "#" should replace the "?" text in the button on Form1.

Attachments sendButtonText.JPG 7.49 KB

whether it is buttons or textboxes, still the same concept

//form 1
frmKeypad frmKey = new frmKeypad();
frmKey.ShowDialog();
this.btnQuestion.Text = frmKey.SelectedKey;


//form 2
private string selectedKey;
public string SelectedKey
{
get{ return selectedKey; }
}

//sample with just one button
 private void btnOne_Click(object sender, EventArgs e)
{
this.selectedKey = "1";
}

you can get creative with this and use a more generic method of doing this, but those are the basics

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