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. Visual Basic
  4. delete

delete

Scheduled Pinned Locked Moved Visual Basic
help
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.
  • M Offline
    M Offline
    Makniteasy
    wrote on last edited by
    #1

    I am trying to add a delete button. I need it to delete the selected row in a datagrid. My Dataset is called as DS.I am working with an xmlfile.I already have an add button that is functioning properly: Dim myRow As DataRow myRow = DS.Tables(0).NewRow() myRow(0) = TextBox1.Text myRow(1) = TextBox2.Text myRow(2) = TextBox3.Text myRow(3) = TextBox4.Text myRow(4) = TextBox5.Text DS.Tables(0).Rows.Add(myRow) TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() I just need the delete button. any help would be greatly apprecitated.

    L 1 Reply Last reply
    0
    • M Makniteasy

      I am trying to add a delete button. I need it to delete the selected row in a datagrid. My Dataset is called as DS.I am working with an xmlfile.I already have an add button that is functioning properly: Dim myRow As DataRow myRow = DS.Tables(0).NewRow() myRow(0) = TextBox1.Text myRow(1) = TextBox2.Text myRow(2) = TextBox3.Text myRow(3) = TextBox4.Text myRow(4) = TextBox5.Text DS.Tables(0).Rows.Add(myRow) TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() I just need the delete button. any help would be greatly apprecitated.

      L Offline
      L Offline
      Levi Rosol
      wrote on last edited by
      #2

      Datagrid? or Dataset? I am assuming you mean you want to delete a row from your dataset. If that is the case, you first need to know what row you want to delete. once you know that, you should be able to do DS.Tables(0).Rows.Remove or .Delete. Can't remember off the top of my head. Are you displaying this data in a datagrid object? If so, you will need to capture the id of the row you are on, and will then want to utilize the ItemCommand event of the DataGrid. Levi Rosol Blog By Levi[^]

      M 1 Reply Last reply
      0
      • L Levi Rosol

        Datagrid? or Dataset? I am assuming you mean you want to delete a row from your dataset. If that is the case, you first need to know what row you want to delete. once you know that, you should be able to do DS.Tables(0).Rows.Remove or .Delete. Can't remember off the top of my head. Are you displaying this data in a datagrid object? If so, you will need to capture the id of the row you are on, and will then want to utilize the ItemCommand event of the DataGrid. Levi Rosol Blog By Levi[^]

        M Offline
        M Offline
        Makniteasy
        wrote on last edited by
        #3

        I want the user to be able to delete any row selected. Yes the data is displayed in a datagrid. how do I capture the ID? And just as a little memory refresher its Remove. thanks for the help.

        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