Hi
How do I out form a textbox when the user click a button, I have a textbox and someone buttons and want that when the user click in the CANCEL button, It ignore the validate event
How do I do It ?
thanks
Printable View
Hi
How do I out form a textbox when the user click a button, I have a textbox and someone buttons and want that when the user click in the CANCEL button, It ignore the validate event
How do I do It ?
thanks
Just a suggestion
Why don't you create a boolean set it to false when the user click Cancel, then in the validate event code do nothing if the boolean is false!
But perhaps, i don't really understand what u need!
Hi , thanks
I tried but do not work
thanks
i just tried this...
it worked fineCode:Dim tmp As Boolean
Private Sub Command1_Click()
tmp = True
End Sub
Private Sub Text1_Validate(Cancel As Boolean)
If tmp = True Then Exit Sub
MsgBox "hello"
End Sub
VBBrowser v2.0.6
Hi
do not work , because the textbox is with setfocus, It work in the second time that I click in the button, I want that with the focus in the text box , It look that I clicked in the button
thanks
Set the causes validation property of the cancel button to false.
when I set to false ? , because if I set to false, It go out all.
Why don't you just set the causesvalidation property to false on the cancel button and it will not run the validate event for the text box.
By setting the causes validation property to false, when cllick the cancel button it will not trigger the validate event in the control that has the focus. This is what you asked, is it not?
Please be more specific when you say "it go out all".
That's an actual question for the Desktop 70-175 test exam for the MCSD.
Yep..I remember that question, I got it correct :D
I saw it on the 176 exam.
Forms & controls section. I haven't taken it yet. I am studying iam set to take it in two weeks. Any tips? I have tried to get the transcenders "no luck". I have the sybex version,but they donot compare to the transcenders. Everyone want's money for them and i can understand if they paid for them. I would give them out to help a fellow programmer. jeje:cool:
Well, basically my test revolved around COM, Deployment, and Debugging (mostly watches). The form and controls questions are a cake walk if you understand the main concepts and how they flow together. Good luck, I didn't use the transcenders, I just studied for about 4 days and went ahead and took it. Not that tough, dont sweat it to much. :D
Check this out for strange:
To a new project add two text boxes. Dump in the code below, and try and enter non numeric data, you can't, which is cool.
Now change the causes validation property of textbox1 to false. Now try and enter data, you can enter non-numeric data in both text boxes, when text1 data should be validated when tabbing to text2.
So you should be very careful when setting causes validation to false. Only do this for a cancel button, otherwise always leave causes validation = true. That's my conclusion anyway, what do others think?
Code:Private Sub Text1_Validate(Cancel As Boolean)
If Not IsNumeric(Text1) Then Cancel = True
If Cancel = True Then MsgBox "Please enter numeric data only"
End Sub
Private Sub Text2_Validate(Cancel As Boolean)
If Not IsNumeric(Text2) Then Cancel = True
If Cancel = True Then MsgBox "Please enter numeric data only"
End Sub
How I setting the causes validation property from Cancel Button ?
the textbox is with focus, only in second click It look the variable tmp = true
Dim tmp As Boolean
Private Sub Command1_Click()
tmp = True
End Sub
Private Sub Text1_Validate(Cancel As Boolean)
If tmp = True Then Exit Sub
MsgBox "hello"
End Sub
Please help me
You don't have to set the causes validation property via code, you can do it design time, usually about five properties below where you change the control name alphabetically.
See attached for example where the causes validation property of the cancel button has been set to false.