Removing row from DataGridView

If user would like to edit some data in DataGridView he might remove selected row. DataGridView is a control to show data from database.

Attention! This post has been published on my old website that has been down. I’m archiving old not verified posts for possible future use. Please be careful when using this post content.

In following code selected row is removing from DataGridView2 this my control name. Remove buttom is hidden in MenuStrip:

Private Sub UusnItemToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UusnItemToolStripMenuItem.Click
' Removing selected row from dgv2
For Each row As DataGridViewRow In DataGridView2.SelectedRows
    DataGridView2.Rows.Remove (Row)
End Sub

There is possiblity to extend code to ask user to confirm decision while he wants to remove selected row:

Private Sub UsuńZaznaczonyProduktToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UsuńZaznaczonyProduktToolStripMenuItem.Click
' Removing product's row in DataGridView from products' list

Dim i, j, TakNie As Integer
j = DataGridView2.CurrentRow.Index
i = DataGridView2.Rows.Count

TakNie = MsgBox("Would you like to remove " & DataGridView2.Item(0, j).Value & " from order?" & _
                Chr(10) & Chr(10) & "Continue?", vbYesNo + vbQuestion, "APP QUESTION...")

If TakNie = MsgBoxResult.Yes Then
        For Each row As DataGridViewRow In DataGridView2.SelectedRows
            DataGridView2.Rows.Remove (Row)
    Catch ex As Exception
        MsgBox("Error happened." + Chr(10) + Chr(10) + "Err no.:" + Chr(10) + ex.Message, _
       MsgBoxStyle.Critical, "ORDER CLEARING......")
    End Try
' Nothing happened, user chosen CANCEL button
End If
End Sub

93 thoughts on “Removing row from DataGridView

  1. Pingback: cialis over the counter

  2. Pingback: hemp oil canada legal

  3. Pingback: card dump sites

  4. Pingback: cc and dumps

  5. Pingback: Devops

  6. Pingback: american express cvv code

  7. Pingback: nằm mơ thấy rùa đánh số mấy

  8. Pingback: toto hk

  9. Pingback: 메이저놀이터

  10. Pingback: 3a/3b hair

  11. Pingback: dumps pin,dumps pin shop

  12. Pingback: 301 redirect htaccess

  13. Pingback: credit card dumps for sale

  14. Pingback: mơ thấy đá bóng đánh con gì

  15. Pingback: mơ thấy đi chợ

  16. Pingback: nằm mơ thấy phật bà quan âm

  17. Pingback: mơ thấy nhẫn vàng đánh con gì

  18. Pingback: mơ thấy giày dép đánh con gì

  19. Pingback: | dumps with pin | fresh dumps shop | dumps with pins | buying dumps online | dump pin | dump+pin | dumps and pins | dumps and pin | dumps with pin atm cash out | dumps with pin 2020 | free credit card dumps with pin 2020 | dumps with pin shop | dumps wit

  20. Pingback: mơ thấy chìa khóa

  21. Pingback: nằm mơ thấy cháy rừng

  22. Pingback: mơ cãi nhau đánh con gì

  23. Pingback: mơ thấy con sâu

  24. Pingback: DevSecOps

  25. Pingback: mơ cá trê đánh con gì

  26. Pingback: nằm mơ thấy ngựa đánh số gì

  27. Pingback: nằm mơ thấy hoa sen

  28. Pingback: mơ cá sấu đánh con gì

  29. Pingback:

  30. Pingback: nằm mơ thấy bướm

  31. Pingback: mơ thấy cầu vồng

  32. Pingback: nằm mơ thấy hôn môi

  33. Pingback:

  34. Pingback: iklan instagram

  35. Pingback: nằm mơ thấy ốc đánh con gì

  36. Pingback: 마나모아

  37. Pingback: สูตรบาคาร่า

  38. Pingback:

  39. Pingback: fake watches

  40. Pingback: california cornhole

  41. Pingback: full body fishnet

  42. Pingback: กู้เงิน อุบลราชธานี

  43. Pingback: home-remodeling-directory

  44. Pingback: nằm mơ thấy bị mất đồ

  45. Pingback: mơ thấy chim bồ câu

  46. Pingback: mơ thấy quả ổi đánh con gì

  47. Pingback: mơ thấy voi

  48. Pingback: mơ thấy sếp cũ

  49. Pingback: mơ thấy con đỉa

  50. Pingback: cách tỏ tình lãng mạn

  51. Pingback: con ngựa số mấy

  52. Pingback: metformin usa

  53. Pingback: propecia hair growth

  54. Pingback: buy propecia canada

  55. Pingback: can i buy cialis in uk

  56. Pingback: ed meds online

  57. Pingback: legit canadian pharmacy

  58. Pingback: generic cialis 20 mg tadalafil

  59. Pingback: canadian pharmacy viagra 50 mg

  60. Pingback: buy cheap cialis uk

  61. Pingback: buy cialis in miami

  62. Pingback: canada cialis online

  63. Pingback: cost of without insurance

  64. Pingback: buy online europe

  65. Pingback: does viagra work the first time?

  66. Pingback: lisinopril 20 mg online

  67. Pingback: cialis orders paypal paid

  68. Pingback: how to get a cialis prescription

  69. Pingback: find cheapest cialis pills

  70. Pingback: walmart pharmacy store 100

  71. Pingback: cialis bph

  72. Pingback: monthly cost of cialis without insurance

  73. Pingback: voltaren gel canadian pharmacy

  74. Pingback: fastest delivery of generic cialis

  75. Pingback: cialis 20mg low price

  76. Pingback: canadian pharcharmy onlinecanadian online pharmacy

  77. Pingback: cost of tadalafil without insurance

  78. Pingback: free samples of cialis online

  79. Pingback: buy cialis online overnight

  80. Pingback: natural cures for ed

  81. Pingback: tadalafil side effects

  82. Pingback: how much is a valtrex prescription

  83. Pingback: generic viagra sildenafil

  84. Pingback: medication for ed

  85. Pingback: daily cialis

  86. Pingback: sildenafil generic viagra

  87. Pingback: cialis timeline

  88. Pingback: rush limbaugh viagra

  89. Pingback: cialis costco price

  90. Pingback: prescription free viagra

  91. Pingback: how much is viagra

  92. Pingback: generic medications cialis

  93. Pingback: sildenafil 100mg generic

Leave a Reply

Your email address will not be published. Required fields are marked *