Jul 012011
 

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>