Hello All
i have windows App
some text boxs
i tab between textbox by this code
private void AstTxt_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
AltTxt.Focus();
}
}
but i want when go next text box
select data in this textbox not delete it
Jignesh TrivediPosted Mar 18, 2015, 12:11 AM
Hi,
you can also write this code in Enter event of text box
private void textBox1_Enter(object sender, System.EventArgs e){
if (!String.IsNullOrEmpty(textBox1.Text))
{
textBox1.SelectionStart = 0;
textBox1.SelectionLength = textBox1.Text.Length;
}
}
hope this will help you.
Ramadan ElmahdyPosted Mar 17, 2015, 4:45 PM
private void AstTxt_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
AltTxt.Focus();
AltTxt.SelectionStart = 0;
AltTxt.SelectionLength = AltTxt.Text.Length;
}
}