Select or Focus, Which One to Use?

Quite a few Windows Forms controls have both Focus() and Select() methods available. This presents unique challenge - which method to use?

While they both offer same result (ok, almost same) there is subtle difference. Focus is intended only for control authoring, e.g. when you have some composite UserControl. For all other scenarios, Select should be used. Probably nothing bad will happen (or maybe some kittens will die) if you use Focus on controls that behave. However, small differences might force you to use Select on some other controls and that leads to code with uses Focus half of time and Select another half. Kinda hard to read.

It might improve actual readability if Select is used all the time.

Leave a Reply

Your email address will not be published. Required fields are marked *