Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,

I'm new. I'm developing an application with VB.NET that must be able to open a window and compile some fields using only keyboard button...

The first field have to write a code like "0542645" then have to focus to another textbox with the TAB button and so on. I'm using WINDOWS 10.

Have you any ideas?

Thanks.

What I have tried:

The problem is that the classic SendKeys function doesn't work in that program, I tried the same code with the "Notepad" and it works. Is there any alternative? I tried also to use SendMessageA script but nothing.
Posted
Updated 22-Jun-17 10:45am
v2
Comments
sameer549 22-Jun-17 8:01am    
did you try Using both SendKeys.Send() and SendKeys.Sendwait() ??
Impakto91 22-Jun-17 8:49am    
Yes but it doesn't work!
Dave Kreskowiak 22-Jun-17 9:03am    
Unless you're "opening a window" in the application you're writing you're actually launch an outside process/application. You would never use SendKeys inside your own application.

Now, what's the external application? Whether or not SendKeys works depends on the application you're sending keystrokes to.
Impakto91 22-Jun-17 9:10am    
For testing I wrote this code:

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
SendKeys.Send("C")
SendKeys.SendWait("C")
End Sub

and it works with the notepad. The application I would to use is a management software.
Dave Kreskowiak 22-Jun-17 11:13am    
That doesn't answer my question at all.

1 solution

Maybe you can try PostMessage, see: VB.NET Sending Strings via Postmessage - Stack Overflow[^]
Another option would be to use a utility like [AutoHotkey]
 
Share this answer
 
Comments
Impakto91 23-Jun-17 9:40am    
PostMessage doesn't work. AutoHotKey I don't know how it works, I tried to import the DLL from Visual Studio but I don't know how to use that function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900