I'm a newbie to C# and following along in a magazine with some exercises to develop a Find dialog and as you click on Find Next - it is supposed to highlight within the text box of Main Form what it has found.
Well what I've noticed is that until you close out of the Find dialog form you don't see what has been highlighted as found in the main form. So I tried to add some code under the Find Next button - frmMain.txtMain.Focus();
Here is the complete listing:
private void btnFind_Click(object sender, EventArgs e)
{
frmMain parent_form = (frmMain)Owner;
parent_form.DoFind(txtFind
What.Text,
rdoDown.Checked, chkMatchCase.Checked);
frmMain.txtMain.Focus();
}
Now I get the error Error 1 'NotPad.frmMain.txtMain' is inaccessible due to its protection level C:\Users\Stephen LeCompte\Documents\Visual Studio 2005\Projects\NotPad\NotPa
d\frmFind.
cs 22 21 NotPad
How may I overcome this error - to allow for this to happen? Or is this not possible since I have a floating dialog form over the main form?
Start Free Trial