uct Posted August 16, 2003 Posted August 16, 2003 Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar < "0" Or e.KeyChar > "9" Then If e.KeyChar = Chr(8) Or e.KeyChar = "." Then Exit Sub End If e.Handled = True ^^^^^^^^^^^ End If End Sub I have a problem with the concept of e.handled... on my own, if e.handled=true that is mean that it should handle wat i type and show it on the textbox.... if e.handled=false it means that It should not handle wat I type and dun show it on the textbox....However wat I think is wrong and or all inverse....Can experts explain to me? Really Thanks:) Quote
Leaders dynamic_sysop Posted August 16, 2003 Leaders Posted August 16, 2003 (edited) i dont know if you've used vb6, but if you imagine the unload event, if you set Cancel to 1, you can't unload ( which would be an equivalent to a boolean of True ) '/// This is VB6 Code... Private Sub Form_Unload(Cancel As Integer) If Cancel = False Then '/// basically same as e.Handled = False MsgBox "it's ok to unload! the cancel value is 0" ElseIf Cancel = True Then '/// e.Handled = True MsgBox "you can't unload, the value is 1" End If End Sub not sure if that explains it for you or not. Edited August 16, 2003 by dynamic_sysop Quote
Administrators PlausiblyDamp Posted August 16, 2003 Administrators Posted August 16, 2003 e.Handled = true means you have dealt with the keypress and no further action is required by the control, normally this will result in the key that had been pressed being ignored by the control. e.Handled = false means the control can carry on and process the keystroke. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.