user1608730
user1608730

Reputation: 25

SendKeys doesn't work correctly VB.NET

I want to press enter key by VB.NET...I tried lots of codes but no one worked.
I tried:

SendKeys.Send("(Enter)")  

SendKeys.Send(Keys.Enter)

SendKeys.Send("Enter")

What can I do?

Upvotes: 0

Views: 7068

Answers (2)

Mark Hall
Mark Hall

Reputation: 54562

In addition to what Andy states, Visual Basic has some default Constants built in. Try using vbCrLf or vbCR all of them will work.

i.e.

SendKeys.Send(vbCrLf)

or

SendKeys.Send(vbCr)

Upvotes: 1

Andy Raddatz
Andy Raddatz

Reputation: 2892

I haven't tried it, but from this link in MSDN Library: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx

...you should be using:

SendKeys.Send("{ENTER}")

or

SendKeys.Send("~")

Upvotes: 3

Related Questions