Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Can't remove the last row from datagridview

Can't remove the last row from datagridview

Scheduled Pinned Locked Moved C#
helpdatabasesql-serversysadmintutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NewToAspDotNet
    wrote on last edited by
    #1

    Hi All, Im very new in this and im trying to use a datagridview to show some data from sql server. The user can select multiple rows in the datagridview and ofter pressing the 'del key' and clicking on the 'Save'button, the selected rows will be removed. The problem is that the last row always remains and can't be remove. Here some code of how im trying to update the datatable : myconn = new SqlConnection(ConnectionString); SqlCommandBuilder cb_imp = new SqlCommandBuilder(myda); myconn.Open(); myda.Update(mydt); Can anyone tell me how to fix this? Thanx.

    P 1 Reply Last reply
    0
    • N NewToAspDotNet

      Hi All, Im very new in this and im trying to use a datagridview to show some data from sql server. The user can select multiple rows in the datagridview and ofter pressing the 'del key' and clicking on the 'Save'button, the selected rows will be removed. The problem is that the last row always remains and can't be remove. Here some code of how im trying to update the datatable : myconn = new SqlConnection(ConnectionString); SqlCommandBuilder cb_imp = new SqlCommandBuilder(myda); myconn.Open(); myda.Update(mydt); Can anyone tell me how to fix this? Thanx.

      P Offline
      P Offline
      panoskatws
      wrote on last edited by
      #2

      Have you selected the property "AllowUserToAddRow" of the datagridview to false?

      N 1 Reply Last reply
      0
      • P panoskatws

        Have you selected the property "AllowUserToAddRow" of the datagridview to false?

        N Offline
        N Offline
        NewToAspDotNet
        wrote on last edited by
        #3

        yes i did

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups