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. How to get a Dataset Selected Index number?

How to get a Dataset Selected Index number?

Scheduled Pinned Locked Moved Visual Basic
databasehelpcsstutorialquestion
1 Posts 1 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.
  • K Offline
    K Offline
    kayos592
    wrote on last edited by
    #1

    I have a datagrid whose datasource is a dataset. Dim DiagCmd As DbCommand = db.GetStoredProcCommand("p_Get_All_Diags") Dim dsDiags As DataSet = New DataSet("Diagnostic_Codes") dsDiags = db.ExecuteDataSet(DiagCmd) dgDiags.DataSource = dsDiags.Tables(0).DefaultView The above works..... Now, I want to be able to click a button and move an item from one grid to another... sounds simple enough.... The code to do that is below.... Private Sub btnNxt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNxt.Click dsAuto.Tables(0).Rows.Add(dsDiags.Tables(0).Rows(dgDiags.RowSel - 1).ItemArray) End Sub and this works.... my problem is if I click on the columnheader and change the sort order it will move the item based on how they originally appeared in the grid. ie. if the grid starts with A-Z and I click the header making it Z-A.... if I then click Z(Which is now at the top) and click my btnNxt it will move A. Anybody help is greatly appreciated...

    -Kay

    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