question

LanceJames-3930 avatar image
0 Votes"
LanceJames-3930 asked LanceJames-3930 commented

ErrorProvider access from custom TextBox on a Form

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

dotnet-csharp
screenshot-1.png (23.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered LanceJames-3930 commented

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

91864-figure1.png



figure1.png (18.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you.

Regards, Lance

0 Votes 0 ·