I'm working with a windows application.(.net/c#) on load I want to make first/default control as selected and start dataEntry without using mouse.
After I add this.ActiveControl = myTextbox;
OR myTextbox .Select();
It would work fine looking on UI
but the same is not active or typable without using mouse initially. I tried the same for Company combobox also and not working expected manner.
I Tried with Focus() as well.
Code:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_context = new CompanyContext();
companyList = _context.Companies.ToList();
var companylist = new BindingList<BPS.Data.Entities.Company>(companyList);
metroComp.DataSource = companylist;
metroComp.DisplayMember = "CompanyName";
metroComp.ValueMember = "CompanyName";
this.ActiveControl = myTextBox;
//myTextBox.Select();// Tried this line also and working same effect
}
I tried that code in Form_Load also