472,117 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 software developers and data experts.

Gettin no KeyPress event

KC
I'm trying to build a simple text editor in part of my app. Right now I'm
just testing the basics of the KeyPress event handler. The code is
basic...real simple. I'm just testing stuff -
Private Sub txtConsole_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtConsole.KeyPress
Dim ch As Char
If System.Char.IsControl(e.KeyChar) Then Exit Sub
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
MsgBox(FTPline)
Else
FTPline = FTPline + e.KeyChar.ToString
End If
End Sub

The problem is the app never gets to the code. Why!? I went to the textbox
and chose the KeyPress event and then stuck the code in it. When I put a
breakpoint in the code it say the breakpoint will not be hit and, "No
symbols have been loaded for this document."??? Is this another one of those
VB.net 'improvements'??
Nov 20 '05 #1
2 1331
KC
Never mind...I'm an idiot. I had it in "Release" mode rather than "Debug".
"KC" <yo*@dontneed.this> wrote in message
news:O7***************@TK2MSFTNGP11.phx.gbl...
I'm trying to build a simple text editor in part of my app. Right now I'm
just testing the basics of the KeyPress event handler. The code is
basic...real simple. I'm just testing stuff -
Private Sub txtConsole_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtConsole.KeyPress
Dim ch As Char
If System.Char.IsControl(e.KeyChar) Then Exit Sub
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
MsgBox(FTPline)
Else
FTPline = FTPline + e.KeyChar.ToString
End If
End Sub

The problem is the app never gets to the code. Why!? I went to the textbox
and chose the KeyPress event and then stuck the code in it. When I put a
breakpoint in the code it say the breakpoint will not be hit and, "No
symbols have been loaded for this document."??? Is this another one of those VB.net 'improvements'??

Nov 20 '05 #2
* "KC" <yo*@dontneed.this> scripsit:
I'm trying to build a simple text editor in part of my app. Right now I'm
just testing the basics of the KeyPress event handler. The code is
basic...real simple. I'm just testing stuff -
Private Sub txtConsole_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtConsole.KeyPress
Dim ch As Char
If System.Char.IsControl(e.KeyChar) Then Exit Sub
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
MsgBox(FTPline)
Else
FTPline = FTPline + e.KeyChar.ToString
End If
End Sub


I am not sure what's the purpose of the code, but typically instead of
searching for 'ChrW(13)', a default button is used on the form. To do
that, assign a button to the form's 'AcceptButton' property. If the
textbox has focus and Return is pressed, the button's 'Click' event will
execute, and there you can get the text from the textbox and display it.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Darryn Ross | last post: by
3 posts views Thread by Terry Olsen | last post: by
3 posts views Thread by Fia | last post: by
3 posts views Thread by Nikolay Evseev | last post: by
2 posts views Thread by Tony Johansson | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.