Results 1 to 5 of 5

Thread: delete data from datagrid

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2003
    Location
    Kl, Malaysia
    Posts
    8

    Unhappy delete data from datagrid

    Dear all,
    how to select the row at the datagrid and press delete key to delete the data from the datagrid as well as database.
    as i tried to delete the data from the datagrid, it just remove from the datagrid display only but not the database.

    anybody can show me some code to do this feature,
    thank you very much.
    chowboon

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    The row state will be set to deleted and when you update the data set, it will be removed from the database.

  3. #3
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    so, just delete from the db and then refresh your grid
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  4. #4
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    ok, so suppose you don't want to refresh the whole grid. for instance, if you have 100 rows and you wish to delete row 95 from the grid, when you refresh the data grid, it then positions the current row to the very top, and then your user gets the ****s when they have to keep scrolling down to find "their current row"

    what's the code to just delete one row of a datagrid?
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  5. #5
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    i suppose this is one to way to do it.....

    Code:
                Dim intRow As Integer = grdMembers.CurrentRowIndex
                Group_MembersLoad(intGroupID, grdMembers)
                Try
                    grdMembers.CurrentRowIndex = intRow - 1
                Catch
                End Try
    (just taking me a while to put my brain into gear this morning - few dwinkies last night... )
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width