473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1374
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Darryn Ross | last post by:
Hi, I am trying to catch the KeyPress event on my datagrid but it isn't working... i have also tried registering the handler with the event like this... dgGLBatch.KeyPress += new...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Terry Olsen | last post by:
Is there anyway to cause a KeyPress event in a datagrid cell? The only way I get a keypress event is if none of the cells are selected. I was hoping to have the program respond to a certain...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
3
by: Nikolay Evseev | last post by:
Hi, I am trying to trace down the Enter key in my Form.KeyPress event handler. The KeyPreview property is set to false, so I'd assume that all key presses should go through my form's KeyPress...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.