How can I correct.
I have textbox that is empty and where the cursor is flashing and I wish to move to other textboxes.
What happens is that the error message is displayed first and when I press OK, only then can I move to the other textboxes. How do I stop this happening. Am I missing some code. Hope somebody can help me.
Private Sub salesInput_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles salesInput.Validating
'' Determines if the input is a number, or if it is a correct value between 1 and 50,000
If Not IsNumeric(salesInput.Text) Or Val(salesInput.Text) < 0 Or Val(salesInput.Text) > 50000 Then
MessageBox.Show("Only use numbers up to 50,000.00", "Input Error")
'' There is a problem MessageBox shows before leaving TextBox
Sorry for my mistakes ref Tags. I’ll get it right next time.
However, I tried what you suggested and was unable to do anything.
OK.CausesValidation = False
to my code and got the following error " Name OK is not declared ".
I tried to Dim OK As String and the error message changed to "CausesValidation is not a member of String" I also tried Integer, Double, Boolean and Single.
Is there a reason for this.
I probably didn’t say I was using Visual Basic 2008 Express.
Still hoping for a way around this problem
The problem though, is that the buttin that I refer to, is the one in the messagebox and I don't know if your code will work for that. I have scoured the net to try to get an answer for this particular problem, but it doesn't seem to be covered.
managed to get over the problem.
I made it impossible to input text into a numeric textbox and I made it impossible to enter numeric data into a text only textbox.
This did away with the messagebox error and left control of the cursor to the user.