Hey guys,
Just trying to create a Find Dialogue for my application. The code for when the user clicks the Edit->Find menu option so far looks like:
CODE
private void findToolStripMenuItem_Click(object sender, EventArgs e)
{
Find FindDialogue = new Find();
FindDialogue.Show(this);
}
Find (Which is just another form) has a public string property named TextToFind, and if I am just using Find as a ShowDialog (so that Find can't lose the focus), then FindDialogue.TextToFind is set to the value in the textbox. The (working) code for this is:
CODE
private void findToolStripMenuItem_Click(object sender, EventArgs e)
{
Find FindDialogue = new Find();
FindDialogue.ShowDialog(this);
MessageBox.Show(FindDialogue.TextToFind);
}
This code displays in a messagebox the text entered as expected.
But if I just use Show as displayed originally (and as I want to), then how do I determine when the Find buton has actually been pressed? Do I need to use a Delegate/Event that triggers the primary form to do the search? That is what I'm thinking is required, but would like to confirm that I'm not just overcomplicating the issue?
Thanks for your help guys.
EDIT: I have already allocated DialogResult's to the various buttons in the form, but for the modeless version I still think the event/delegate is required before these would be of any value.
This post has been edited by wingot: 15 Oct, 2008 - 05:35 AM