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. want to generate

want to generate

Scheduled Pinned Locked Moved Visual Basic
databasetutorial
4 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.
  • S Offline
    S Offline
    sathyan_8294
    wrote on last edited by
    #1

    hai all, here i have a code to generate serial no in datagridview. If e.RowIndex >= 0 AndAlso e.ColumnIndex = SLNo.Index Then e.Value = e.RowIndex + 1 ' + 1 is becuase RowIndex is a zero based End If using above code,serial nos are displayed in ascending order. but i want to display the serial nos in descending order. so how to display the serial nos in descending order.

    B 1 Reply Last reply
    0
    • S sathyan_8294

      hai all, here i have a code to generate serial no in datagridview. If e.RowIndex >= 0 AndAlso e.ColumnIndex = SLNo.Index Then e.Value = e.RowIndex + 1 ' + 1 is becuase RowIndex is a zero based End If using above code,serial nos are displayed in ascending order. but i want to display the serial nos in descending order. so how to display the serial nos in descending order.

      B Offline
      B Offline
      Bardy85
      wrote on last edited by
      #2

      Are you populating the dataGridView from SQL.

      S 1 Reply Last reply
      0
      • B Bardy85

        Are you populating the dataGridView from SQL.

        S Offline
        S Offline
        sathyan_8294
        wrote on last edited by
        #3

        hai bardy, The datas only displayed from sql.I genarate serial no automatically using above code.It comes in ascending order.but i want to display in descending order.

        B 1 Reply Last reply
        0
        • S sathyan_8294

          hai bardy, The datas only displayed from sql.I genarate serial no automatically using above code.It comes in ascending order.but i want to display in descending order.

          B Offline
          B Offline
          Bardy85
          wrote on last edited by
          #4

          Well I'm assuming that you pull the data from Sql into a DataSet then bind it to the GridView. You can get the Total number of rows from the DataSet (int TotalRows = ds.Rows.Count) then when you set the serial No just go (TotalRows - e.RowIndex), that should be in Descending order. Hope this helps.

          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