SendMessage or SendKeys ??

I'm trying to automate the process of sending text to an application. The application consists of several textboxes. Not sure which method would work SendMessage or SendKeys.

This question is related to an earlier EE question: ID: 27998591 concerning automating mouse/cursor movement.

Attached a screen print of the application displaying the textboxes.

I need to enter the text: Dave into the "FIRST NAME" textbox and Jones into the "LAST NAME" textbox and then automate the "ENTER" key.

Richard KreidlSoftware DeveloperAsked:
Who is Participating?
Luis PérezSoftware Architect in .NetCommented:
Microsoft.VisualBasic.Interaction.AppActivate("Window title of the window you want to activate")
Luis PérezSoftware Architect in .NetCommented:
Well, you can use AppActivate to set the focus on the client application, then use SendKeys to send the keystrokes. To change the active field inside the client window, you can send a {TAB} with SendKeys too.
Richard KreidlSoftware DeveloperAuthor Commented:
Could you please show code for the AppActivate method??
Richard KreidlSoftware DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.