Beginning VB 6For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I want to unload the form by pressing "ESC" Key but I hvae 48 Textfield in my Form so i will have to write use this function which is given below for each TextField. Pls anyone can give me any small method to do that
I mean can I get the exact object name(Like TextBox1) having Focus....
And I don't want to take array of TextBox.
Private Sub txtname_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
Unload Me
End If
End sub
Set it when you are in Design mode, not in run time.
Not type Set Form.KeyPreview = true in code, but set this property to true on form property panel.