Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,404 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,452 people online right now. Registration is fast and FREE... Join Now!




What is the alternative for Sendkeys?

 
Reply to this topicStart new topic

What is the alternative for Sendkeys?, Sendkeys does not work under Vista, so how do I tab to the next field

airebase
3 Sep, 2008 - 03:56 PM
Post #1

New D.I.C Head
*

Joined: 3 Sep, 2008
Posts: 1

I have a program, written in VB5, which uses Sendkeys to Tab to the next entry field on a form, by using the following code :

vb

Private Sub txtInput_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 then
SendKeys = "{TAB}"
KeyAscii = 0
End If
End Sub


Under Vista, this gives a protection error. What is the easiest alternative code that I can use?

Thanks for your help.

JC.
User is offlineProfile CardPM
+Quote Post

thava
RE: What Is The Alternative For Sendkeys?
3 Sep, 2008 - 04:56 PM
Post #2

D.I.C Regular
Group Icon

Joined: 17 Apr, 2007
Posts: 442



Thanked: 18 times
Dream Kudos: 50
My Contributions
i think you want to set your focus to the next control
try this
vb

Private Sub txtInput_KeyPress(KeyAscii As Integer)
controlname.setfocus
End Sub

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 11:43AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month