I have a textbox control. In my Leave Event handler I check to see if it matches certain criteria and if it does not, I display a messagebox and TRY to set focus back to the textbox. This is not working for some reason. It displays the message box but does not do the other code withing the handler:
if(!isNumeric)
{
this.pageGeneral.Focus();
this.txtQuoteNumber.Focus();
this.txtQuoteNumber.Text = this.tempTextBox;
MessageBox.Show("Text must be Numeric Only (YYMMXX)"
}
The messagebox is called when it should be, but my textbox does not take the focus back as it should. Also, when I lose focus by pressing my OK button, I get the focus back to the textbox, but If i lose focus by clicking on a different page in my tab sheet, the page changes and I dont get the focus back. In both cases the text does not change to the this.tempTextBox variable like it should.
Is there similar functionality like the VB6 BeforeUpdate(Cancel as integer) where you can simply set Cancel to True and you will get the focus back + your old data? Any other suggestions?
Thank you.
if(!isNumeric)
{
this.pageGeneral.Focus();
this.txtQuoteNumber.Focus();
this.txtQuoteNumber.Text = this.tempTextBox;
MessageBox.Show("Text must be Numeric Only (YYMMXX)"
}
The messagebox is called when it should be, but my textbox does not take the focus back as it should. Also, when I lose focus by pressing my OK button, I get the focus back to the textbox, but If i lose focus by clicking on a different page in my tab sheet, the page changes and I dont get the focus back. In both cases the text does not change to the this.tempTextBox variable like it should.
Is there similar functionality like the VB6 BeforeUpdate(Cancel as integer) where you can simply set Cancel to True and you will get the focus back + your old data? Any other suggestions?
Thank you.