Validating cancel true

The thing that this approach does not allow (unless I've one again neglected the obvious) is using the escape key to trigger the form cancel. Y Dim HWnd As Int Ptr = Window From Point(p) If HWnd = CType(Me. Handle Then Return True Else Return False End If End Function \\\\\\ -- Al Reid "Al Reid" I had tried all of that, *BUT*, I had neglected to set the button's Causes Validation to False. Why it would stop on a textbox with tabstop property set to False - I have no idea, unless it is a behavior of the container its in.

I also got the Window From Point approach working as well. The following code works as you might hope: Public Class Form1 Private m Canceling As Boolean = False Also, as I just discovered, if you set the text box's causesvalidation to false, you can close the form from the control box without validation taking place. Also in the docs on Key Down there is a mention of "Is Input Key" which I will have to look into. -- Terry Hi Al, Nearly 40 years for me since my first college FORTRAN IV class! Well, one of the keys you would not see in either the keypress or keydown events is the tab key, which of course will move the focus.

One, remove the "control Box" from the form, so the user cant close it that way. in the btn Cancel_Click event: Removehandeler Text Box1.validating, Addressof Text Box1_Validating -- Terry That doesn't work either, at least not for VB2005. Then in the btn Cancel_click event, either set a module level variable like m Canceling to True and then in the validating event ... I've been fighting the same problem for some time now. I think that the only way to do this is to grab the mouse coordinates in the validating event, do a Window From Point API call, then compare the returned HWND to the Cancel Button's Handle. I also got the Window From Point approach working as well. The following code works as you might hope: Public Class Form1 Private m Canceling As Boolean = False Private Sub Button1_Click(By Val sender As System. Private Sub Text Box1_Validating(By Val sender As Object, By Val e As System. As far as the 'gun', it may be better to write a console app. -- Terry "Al Reid" wrote: Terry, I don't do anything with the barcode data in the Key Press event. I guess I could inspect the data in the Key Down event to see if there is a difference. news:78**********************************@microsof .. I am new to VB comming from VB6, but that was also the case in VB6. I added the code to handle the esc key per the "bug" thread and it works.

I am new to VB comming from VB6, but that was also the case in VB6. Length I guess I'm going to have to start with a new project and try it.Its only because of the messagebox that you need to keep the flag. The gun was putting out a LF after the CR and in the Key Down event it showed up as a Keys. Validating If Not mbln Cancel Then Dim dte Date As Date Time If Date Time. Does look like a bug or perhaps and Undocumented System Feature! Why it would stop on a textbox with tabstop property set to False - I have no idea, unless it is a behavior of the container its in. Maybe you should be using the Key Down event instead of the Key Press event. here is a line copied from the documentation: "The Key Press event is not raised by noncharacter keys; however, the noncharacter keys do raise the Key Down and Key Up events." My guess is that the gun is sending some noncharacter data to you. Close() End Sub Private Sub Text Box1_Validating(By Val sender As Object, By Val e As System. The code to tell if the cancel button has been clicked is: /////// Public Declare Function Window From Point Lib "user32" (By Val p As POINTAPI) As Int Ptr Public Structure POINTAPI Dim X As Integer Dim Y As Integer End Structure Private Function Cancel Button Clicked() As Boolean Dim p As New POINTAPI p. As far as the original validation issue, I started a new project (VB2005) and tried your approach It works except that pressing the Esc key still causes the validation event to fire. -- Terry "Al Reid" wrote: Well, I finally solved the barcode scanner problem. Cancel = True End If End If End Sub Private Sub Button1_Click(By Val sender As System. I just don't know what key code combination could direct focus to a text box control that should never receive focus since the Tab Stop property is false and there is no other code that sets focus to the textbox. Also in the docs on Key Down there is a mention of "Is Input Key" which I will have to look into. -- Terry Terry, I tried the same scenario in VB6 and found that it works the way one would expect AND there is no need for the m Cancel flag either. -- Al Reid "Terry" Hi Al, Nearly 40 years for me since my first college FORTRAN IV class! Well, one of the keys you would not see in either the keypress or keydown events is the tab key, which of course will move the focus.

Search for validating cancel true:

validating cancel true-58validating cancel true-24validating cancel true-30

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “validating cancel true”

  1. Shortly after Brady and the Patriots lost out to Eli Manning and the Giants 21-17, the quarterback was reportedly spotted just sitting and staring at the floor of the Patriots locker room in shock for nearly 20 minutes.