The invalid Focus solution is called inside Form_Load
- 2020-05-09 19:05:23
- OfStack
Because I think SplitContainer's dashed line is ugly, I want to move the focus to another control when the program starts.
Added in Form_Load
listview1.Focus();
It didn't work.
I looked it up and found the reason:
When Form_Load is called, Form is not yet in the presentation stage, so the Focus() call will not work.
Solutions:
Call this.Show () before Focus();
Or, more simply, move the Focus() function call to Form_Shown event handling.