I am trying to catch the carrage return with this code I found on net but doesn't seem to work. Nothing happens.
Is there another way to do it
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
Wayne
I am trying to catch the carrage return with this code I found on net but doesn't seem to work. Nothing happens.
Is there another way to do it
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
Wayne
Catching carrage return
AshClarke
Its not a bug, you need to create a derived control and override the Control.IsInputKey method.
protected override bool IsInputKey(Keys keyData)
{
if ((keyData & Keys.KeyCode) == Keys.Enter)
{
return true;
}
return base.IsInputKey(keyData);
}
Protected Overrides Function IsInputKey(ByVal keyData As Keys) As Boolean
If ((keyData And Keys.KeyCode) = Keys.Enter) Then
Return True
End If
Return MyBase.IsInputKey(keyData)
End Function
Once you have done that the KeyPress event should be raised on ENTER.
klva1
I am new to vb net so I don't know anything about derived controls and overiding but am about to find out.
Thanks again,
Hobbit666
Yurgen
Wayne
At times you have to check for Chr (10 ) too .
Shasur
hostile17
A combo box
Private Sub cbbURL_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cbbURL.KeyPress
Draggynsmate
Jing Fan
Siddhartha Dutta
cues7a
If e.KeyChar = (vbcrlf) Then
Marko Tekavc
If e.KeyChar = ControlChars.Cr Then