Send keystroke to a datagridview control

G

Guest

Hi everybody...
i need help with this issue: i have a textbox control with the focus. at
side, i have a datagridview control populated with some data. i need to
control behavior of dgv control from textbox. when i press pagedown/pageup
key (in textbox), i need to send that key to dgw, to move the data up/down,
but, without loss the focus in textbox. i already studied the sendkeys.send,
but i dont know how to send a key to control, the examples just explain how
to control a external app like calculator..

Thanks in advance.
 
E

Earl

You might be better served to use the binding navigator for that purpose
(essentially what it is designed for). In any event, the easiest method to
do what you want with a textbox is probably to use the KeyUp or Keypress
events, parse out the pagedown/pageup keystrokes, then move thru up or down
through a bindingsource attached to the dgv.
 
G

Guest

Hi Earl, thanks for your time.
I can comment, the dgv are binding a datatable, and, when i add data to dgv,
i do this task adding the data to datatable directly. The desired effect is:
i catch pgdn/pgup trough keypress event in a textbox, and move the displayed
data in dvg up/down accordingly. My app have a "data post window", and all
typed data goes to the dgv. but sometimes, you may check what items typed,
and using pgdn/pgup, the user can visualize what are up or down in the
"ticket". i dont know if is possible to send "keystrokes" to a control (in
this case the dgv), or i have to do a different approach (using something
like dgv.firstdisplayedscrollingrowindex). Thanks again for your advice.
 
E

Earl

It would be easier to accomplish what you are trying to do if you bind the
datatable to a bindingsource, then use the bindingsource as datasource for
the dgv.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top