Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disabling Validating event of instance textbox
Message
 
To
04/12/2010 18:39:30
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Miscellaneous
Thread ID:
01491759
Message ID:
01491863
Views:
52
Thanks again bonnie.

BTW is that also the event I would use to translate an "enter" key in a "tab" key. Not sure I like sendkeys to do that.

>I think you want to use a different event Marc. Try overriding the ProcessDialogKey() method like so:
>
>
>Protected Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
>        If ((keyData = Keys.Enter)  _
>                    AndAlso (Me.Text = "")) Then
>            Me.OnValidating(New CancelEventArgs)
>        End If
>        Return MyBase.ProcessDialogKey(keyData)
>    End Function
>
>
>
>~~Bonnie
>
>
>
>>In the base class of the textbox I would like to have :
>>
>>
>>    Private Sub txtBase_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Validating
>>        If f.lastKeycode <> Keys.Enter And Me.Text = "" Then e.handled = True
>>    End Sub
>>
>>
>>and I was hoping that setting e.handled = true would prevent the validating event of its instances to be executed. The problem is that e.handled does not seem to exist in this context.
>>
>>I'm trying to code a behaviour whereby if the user leaves a field blank, the field would be validated.
>>
>>Is there a way to achieve this?
>>
>>Thanks.

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform