0

I have a WinForms C# project targeting .Net Framework 4.7.2 with a form which includes a group box. There is no Click event for this control visible from VS2022 when showing control properties via right-click and selecting events, despite MS documentation (https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.groupbox.click?view=netframework-4.7.2) indicating that it exists.

4
  • 1
    Click is a member of the Control class so all controls have that event. If it's not displayed in the Properties window for a particular control, it's because they don't think you should be handling that event for that control. Why are you? Why do you care about the user clicking a GroupBox? It's not necessarily bad but it's unusual. Commented Jun 3 at 1:37
  • 1
    Yes, because of the [EditorBrowsable(EditorBrowsableState.Advanced)] attribute. See stackoverflow.com/a/3708900/14171304
    – dr.null
    Commented Jun 3 at 1:38
  • 1
    You can set it in code yourself: groupBox1.Click += someeventcode; e.g. before or after InitializeComponent();
    – TaW
    Commented Jun 3 at 6:06
  • Wanting a click on a container control is seldomly useful so its hidden but can be used. You are aware that click does not get passed on? Clicking a control on the groupbox will not progress to the groupbox.
    – Ralf
    Commented Jun 3 at 9:00

0

Browse other questions tagged or ask your own question.