Add / Delete record from table - How to reposition selected record in datagridview???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    Add / Delete record from table - How to reposition selected record in datagridview???

    Hello,

    Using VB 2005.net.

    I have a bound datagridview and a delete button control (or when the user pressed the 'Delete' key) I can successfully delete the selected record from
    the table and it is removed from the dgv. But then I want to select the previous row in the dgv and select it so on 'Select Index Changed' event I
    can populate text boxes referring to the selected row. The user may have selected the 5th row in the dgv then scrolled down to the 80th row and
    pressed the delete button. I want to position at the 4th row of the dgv.

    This is all about selecting rows in dgv, underlying table modification and bringing a selected row into the visible area of the dgv.

    If you have a better way of accomplishing this, please direct me to a link or post instructions/code to get this task done.

    Thanks,

    Bob
  • Cor Ligthert[MVP]

    #2
    Re: Add / Delete record from table - How to reposition selected record in datagridview???

    Bob,

    Use the currencymanager and with that set the postion on 5 again (or
    whatever you want)

    Cor


    "Bob" <Bob@No-Address.comschr eef in bericht
    news:oee0v39ds1 2t7gdnhp8qadi4o mt9sjgn87@4ax.c om...
    Hello,
    >
    Using VB 2005.net.
    >
    I have a bound datagridview and a delete button control (or when the user
    pressed the 'Delete' key) I can successfully delete the selected record
    from
    the table and it is removed from the dgv. But then I want to select the
    previous row in the dgv and select it so on 'Select Index Changed' event I
    can populate text boxes referring to the selected row. The user may have
    selected the 5th row in the dgv then scrolled down to the 80th row and
    pressed the delete button. I want to position at the 4th row of the dgv.
    >
    This is all about selecting rows in dgv, underlying table modification and
    bringing a selected row into the visible area of the dgv.
    >
    If you have a better way of accomplishing this, please direct me to a link
    or post instructions/code to get this task done.
    >
    Thanks,
    >
    Bob

    Comment

    Working...