By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,199 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,199 IT Pros & Developers. It's quick & easy.

Send keystroke to a datagridview control

P: n/a
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.
Apr 28 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

"Bernardo Salazar newb" <Bernardo Salazar ne**@discussions.microsoft.com>
wrote in message news:E8**********************************@microsof t.com...
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.

Apr 29 '07 #2

P: n/a
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.
--
Bernardo Salazar
"Earl" wrote:
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.

"Bernardo Salazar newb" <Bernardo Salazar ne**@discussions.microsoft.com>
wrote in message news:E8**********************************@microsof t.com...
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.


Apr 29 '07 #3

P: n/a
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.

"Bernardo Salazar newb" <Be*****************@discussions.microsoft.com>
wrote in message news:42**********************************@microsof t.com...
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.
--
Bernardo Salazar
"Earl" wrote:
>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.

"Bernardo Salazar newb" <Bernardo Salazar ne**@discussions.microsoft.com>
wrote in message
news:E8**********************************@microso ft.com...
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.



Apr 29 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.