move cursor down after add new item

I use a custom button to add a new item to the transaction grid. After that, the cursor in the transaction grid stays in the newly added line, it doesn't move down to a new line. I searched this newsgroup tried to find a solution. Then I used the SendKeys("{DOWN}") but it still doesn't work. My code is as following:

Public Function Process(ByRef MySession As Object) As Boolean Dim frm As New frmFare ... If frm.ShowDialog = Windows.Forms.DialogResult.OK Then

My.Computer.Keyboard.SendKeys("{DOWN}")

End If

Process = True End Function

In frmFare, when user clicks button OK, it will add new item to the grid then close the form. But just the curson doesn't move down. (and I got an error). I develop all this with vb.net.

Has anyone got an idea? Thank you very much.

Leanne

Reply to
Leanne
Loading thread data ...

Not sure of the correct syntax in .Net, but it looks like your sendkeys may be going to the wrong window/process. See if you can find some way to ensure that the Transaction window has the focus...

Glenn Adams Tiber Creek C> I use a custom button to add a new item to the transaction grid. After

Reply to
Glenn Adams [MVP - Retail Mgmt]

Anyone knows how to set the focus to the transaction window? Please help.

Glenn Adams [MVP - Retail Mgmt] wrote:

Reply to
Leanne

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.