ErrorProvider access from custom TextBox on a Form

Lance James 371 Reputation points
2021-04-27T21:13:28.88+00:00

Using a custom TextBox to trap the Tab key. I dropped the custom TextBox onto the Window Form.

I have discovered how to refer to the controls on the Form from within the class.

                Form f = Application.OpenForms["Form1"] as Form;  
                string s = f.Controls["tabTextBox1"].Text;  

I still need to access an ErrorProvider on the form and can't get the syntax correct. I can see them but just can't determine how to access them.

91891-screenshot-1.png

I found an example online that used Reflection. Hoping there is an easier way.

Regards,
Lance

Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-04-27T22:06:15.857+00:00

    Change the Modifiers property from private to public to access the error provider.

    91864-figure1.png


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.