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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. datagrid

datagrid

Scheduled Pinned Locked Moved Visual Basic
csharptutorialquestion
6 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.
  • V Offline
    V Offline
    vengaqua
    wrote on last edited by
    #1

    how to delete from datagrid? and also i want to display the value of a row in txtbox by double clicking on the row or single click.all this in vb.net.

    Mohinder Singh

    V 1 Reply Last reply
    0
    • V vengaqua

      how to delete from datagrid? and also i want to display the value of a row in txtbox by double clicking on the row or single click.all this in vb.net.

      Mohinder Singh

      V Offline
      V Offline
      vbdotnetcoder2005
      wrote on last edited by
      #2

      As far as deleting from a data grid it depends on how you are populating the data grid and how you normally delete rows from you database. I usually use straight SQL statements with a OleDbCommand, so it that case you would execute the command and then refresh the datagrid to redisplay your results. I'm just guessing but it sounds like you might be trying to delete the row in the data grid that user selected? You can get the selected value of a column in a row based on a double click like this: dgResults.Item(dgResults.CurrentRowIndex, 4) I do this on a double click, and this should give you the selected value you need. Good Luck, Curtis

      V 2 Replies Last reply
      0
      • V vbdotnetcoder2005

        As far as deleting from a data grid it depends on how you are populating the data grid and how you normally delete rows from you database. I usually use straight SQL statements with a OleDbCommand, so it that case you would execute the command and then refresh the datagrid to redisplay your results. I'm just guessing but it sounds like you might be trying to delete the row in the data grid that user selected? You can get the selected value of a column in a row based on a double click like this: dgResults.Item(dgResults.CurrentRowIndex, 4) I do this on a double click, and this should give you the selected value you need. Good Luck, Curtis

        V Offline
        V Offline
        vengaqua
        wrote on last edited by
        #3

        what is dgresults in this dgResults.Item(dgResults.CurrentRowIndex, 4). can u explain this a lillte bit...

        Mohinder Singh

        V 1 Reply Last reply
        0
        • V vbdotnetcoder2005

          As far as deleting from a data grid it depends on how you are populating the data grid and how you normally delete rows from you database. I usually use straight SQL statements with a OleDbCommand, so it that case you would execute the command and then refresh the datagrid to redisplay your results. I'm just guessing but it sounds like you might be trying to delete the row in the data grid that user selected? You can get the selected value of a column in a row based on a double click like this: dgResults.Item(dgResults.CurrentRowIndex, 4) I do this on a double click, and this should give you the selected value you need. Good Luck, Curtis

          V Offline
          V Offline
          vengaqua
          wrote on last edited by
          #4

          and i want the value to be displayed in txtbox....

          Mohinder Singh

          1 Reply Last reply
          0
          • V vengaqua

            what is dgresults in this dgResults.Item(dgResults.CurrentRowIndex, 4). can u explain this a lillte bit...

            Mohinder Singh

            V Offline
            V Offline
            vbdotnetcoder2005
            wrote on last edited by
            #5

            vengaqua wrote:

            what is dgresults in this dgResults.Item(dgResults.CurrentRowIndex, 4). can u explain this a lillte bit...

            Sorry, I should have mentioned that. dgresults is the name of the datagrid. The item will return a datagrid item which requires you to pass it a rowindex and a column index. So I used the currentrowindex of my datagrid and then passed it the column I wanted in this case it was column index of 4. You can also see an example here on MSDN: http://msdn2.microsoft.com/en-us/library/wdze7s55.aspx

            V 1 Reply Last reply
            0
            • V vbdotnetcoder2005

              vengaqua wrote:

              what is dgresults in this dgResults.Item(dgResults.CurrentRowIndex, 4). can u explain this a lillte bit...

              Sorry, I should have mentioned that. dgresults is the name of the datagrid. The item will return a datagrid item which requires you to pass it a rowindex and a column index. So I used the currentrowindex of my datagrid and then passed it the column I wanted in this case it was column index of 4. You can also see an example here on MSDN: http://msdn2.microsoft.com/en-us/library/wdze7s55.aspx

              V Offline
              V Offline
              vengaqua
              wrote on last edited by
              #6

              thanks

              Mohinder Singh

              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