Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
When i Put breakpoint then Focus set correctly ---txtGrpLCode.Text (that is Right)
but normaly run then focus set ---txtSrNo.text (That is wrong)

Pls Help....

Hint..
If my datagride enable false then Work Ok
But i wont datagride enable true

What I have tried:

after insert record ....

txtGrpLCode.Text = "";
txtSrNo.Text = "";
txtTag.Text = "";
txtGrpLCode.Focus();
Posted
Updated 22-Jun-20 14:24pm
v2
Comments
RickZeeland 21-Apr-18 7:12am    
Do you have some #if DEBUG statements in your code maybe ?
Member 10423855 21-Apr-18 8:16am    
No..

Use:
txtGrpLCode.Select();
txtGrpLCode.Focus();
Also, try changing the TabOrder of your Controls at design-time; or, at run-time, by using 'SendToBack, or'BringToFront.

Also try:
C#
this.ActiveControl = txtGrpLCode;
If none of these work, you need to show more of your code.
 
Share this answer
 
v2
Comments
Member 10423855 21-Apr-18 23:23pm    
it's not work...pls other help
BillWoodruff 21-Apr-18 23:34pm    
See revised solution above.
Member 10423855 26-Apr-18 7:34am    
this.ActiveControl = txtGrpLCode;
it's not work
BillWoodruff 26-Apr-18 23:25pm    
I am afraid the techniques I have described are all I know. I am able to take a WinForm and put any Control, including a DataGridView, on it, and use these techniques to force the focus where I want it.
Final Use This ...
private void txtSrNo_Enter(object sender, EventArgs e)
{
if (txtGrpLCode.Text.ToString().Trim().Length == 0)
txtGrpLCode.Focus();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900