Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How do I get the 'Enter' Key to work?


Reply
 
Thread Tools Display Modes
  #1  
Old 04-20-2003, 03:17 AM
MrSimtang MrSimtang is offline
Newcomer
 
Join Date: Apr 2003
Posts: 23
Default How do I get the 'Enter' Key to work?


For my program, I want my enter button to work once I type in text.

What's the code?
Reply With Quote
  #2  
Old 04-20-2003, 03:23 AM
vbfan's Avatar
vbfan vbfan is offline
Senior Contributor
 
Join Date: Dec 2002
Location: Saxony, Germany
Posts: 1,216
Default

I hope that I had understand you right.
Code:
Private Sub Text1_KeyPress(keyAscii AS integer) IF KeyAscii = 13 then Command1_Click End IF End Sub
Reply With Quote
  #3  
Old 04-20-2003, 04:11 AM
MrSimtang MrSimtang is offline
Newcomer
 
Join Date: Apr 2003
Posts: 23
Default

Ok thank you vbfan!!!
Reply With Quote
  #4  
Old 04-20-2003, 04:21 AM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

If all you want to do is cause the Enter key to click a commandbutton, you can simply set the Default property of the commandbutton to True.

__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #5  
Old 04-20-2003, 04:22 AM
vbfan's Avatar
vbfan vbfan is offline
Senior Contributor
 
Join Date: Dec 2002
Location: Saxony, Germany
Posts: 1,216
Default

I had forgot to say, that you need to set the Keypreview to true of the Form
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
command button w/the enter key. jlab13 General 9 04-20-2003 04:04 AM
Java and buged classes. Variables doesn't work with each other! vbSIME Miscellaneous Languages 2 03-11-2003 07:57 AM
Why does it work on my machine nlarge DirectX 3 12-10-2002 07:39 AM
My site for work experience. Does it work? Kitaiko Web Programming 22 06-14-2002 07:54 AM
Can't enter HEX numbers in value textbox? vbfourme General 8 12-10-2001 10:49 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->