Advertisement

06.05.2008 at 09:56AM PDT, ID: 23461014
[x]
Attachment Details

Error msg states- is inaccessible due to its protection level when directing focus from a dialog window to back to the main window?

Asked by stephenlecomptejr in C# Programming Language

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(txtFindWhat.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\NotPad\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
 
Loading Advertisement...
 
[+][-]06.05.2008 at 10:55AM PDT, ID: 21722202

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 11:01AM PDT, ID: 21722263

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 12:10PM PDT, ID: 21722913

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 12:17PM PDT, ID: 21722975

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Sign Up Now!
Solution Provided By: jcoehoorn
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.05.2008 at 12:36PM PDT, ID: 21723122

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 12:47PM PDT, ID: 21723240

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.05.2008 at 12:59PM PDT, ID: 21723355

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628