Send keystroke to a datagridview control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QmVybmFyZG8gU2FsYXphciBuZXdi?=

    #1

    Send keystroke to a datagridview control

    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.
  • Earl

    #2
    Re: Send keystroke to a datagridview control

    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 newb@discussion s.microsoft.com>
    wrote in message news:E8FE1A94-974D-43FA-9D68-B3B73D1ECA49@mi crosoft.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.

    Comment

    • =?Utf-8?B?QmVybmFyZG8gU2FsYXphciBuZXdi?=

      #3
      Re: Send keystroke to a datagridview control

      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.firstdispla yedscrollingrow index). 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 newb@discussion s.microsoft.com>
      wrote in message news:E8FE1A94-974D-43FA-9D68-B3B73D1ECA49@mi crosoft.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.
      >
      >
      >

      Comment

      • Earl

        #4
        Re: Send keystroke to a datagridview control

        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" <BernardoSalaza rnewb@discussio ns.microsoft.co m>
        wrote in message news:420B4D98-BD7F-491D-8E26-3105D0A2A175@mi crosoft.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.firstdispla yedscrollingrow index). 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 newb@discussion s.microsoft.com>
        >wrote in message
        >news:E8FE1A9 4-974D-43FA-9D68-B3B73D1ECA49@mi crosoft.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.
        >>
        >>
        >>

        Comment

        Working...