Data Grid View - Deleting Row

    General discussion

  • Dear Sir,    

    When I'm deleting a row from a data gridview containing many rows, some times more than 1 row is getting deleted, even though i've selected only one row.  I have observed that when i move around a blank row and then select another row by  mouse clicking and press the delete button, this happens.

    I would also like to know, is there any method by which i can find out how many rows will be deleted.

    Your valuable suggestions & reply will be highly appreciated.

    with regards,

    • Changed type Xingwei Hu Thursday, November 20, 2008 2:19 AM changed the type of the thread because you didn't respond in 3 days
    Friday, November 14, 2008 6:54 AM

All replies

  • change Datagridview's property multiselect to false. but thats not an answer

    Can you please show us your code?  just to see how are you deleting.

    Arjun Paudel
    Sunday, November 16, 2008 1:59 PM
  • you are not using proper method to del records, plz see my this example n correct ur code

    Wednesday, December 03, 2008 7:25 PM
  • Dear Irfan,

    It is not the question of using any methods. I'm just pressing the delete button and the rows get deleted. I have not done any coding.

    Monday, January 04, 2010 8:43 AM
  • hi,

    i said method, coz you have to set primery key to any one of your column to delete row properly,  thats why i asked you to see my example at given link, still it does not work, then show me code that i can currect it
    Tuesday, January 05, 2010 5:40 AM