As far as I know you cannot make changes to objects that you get from the foreach command - they are read only.
To change the data, you would need to do a traditional for loop.
There are a couple of things to keep in mind when designing a class that inherits from a Control if you want to interact with it in the Form Designer.
First, you have to be able to create it with a zero parameter constructor.
Second, if your Control class has any fields that are also your own...
I want to see if certain keys are pressed so I can scroll a window if the user is holding down the space bar.
Windows.Forms.Control has the static property ModifierKeys, but that only works for SHIFT, CTRL, and ALT. I need something that works the same way for any key.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.