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. The Lounge
  3. Is it any wonder ...

Is it any wonder ...

Scheduled Pinned Locked Moved The Lounge
csharpcomalgorithmsjsonquestion
8 Posts 5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    ... that new people struggle? A questioner complained that their SortCompare method in a DataGridView did not work. Looking at the code it was clear that they were sorting integer values as strings, which means alphabetic rather than numeric order. So, I went to MSDN to check the documentation, only to discover that OP had copied the code verbatim. And every sample pertaining to sorting in a DataGridView had exactly the same bad code: DataGridViewSortCompareEventArgs Class (System.Windows.Forms) | Microsoft Docs[^].

    M D N Mike HankeyM L 5 Replies Last reply
    0
    • L Lost User

      ... that new people struggle? A questioner complained that their SortCompare method in a DataGridView did not work. Looking at the code it was clear that they were sorting integer values as strings, which means alphabetic rather than numeric order. So, I went to MSDN to check the documentation, only to discover that OP had copied the code verbatim. And every sample pertaining to sorting in a DataGridView had exactly the same bad code: DataGridViewSortCompareEventArgs Class (System.Windows.Forms) | Microsoft Docs[^].

      M Offline
      M Offline
      MarkTJohnson
      wrote on last edited by
      #2

      Richard MacCutchan wrote:

      And every sample pertaining to sorting in a DataGridView had exactly the same bad code

      At least they are consistent.

      1 Reply Last reply
      0
      • L Lost User

        ... that new people struggle? A questioner complained that their SortCompare method in a DataGridView did not work. Looking at the code it was clear that they were sorting integer values as strings, which means alphabetic rather than numeric order. So, I went to MSDN to check the documentation, only to discover that OP had copied the code verbatim. And every sample pertaining to sorting in a DataGridView had exactly the same bad code: DataGridViewSortCompareEventArgs Class (System.Windows.Forms) | Microsoft Docs[^].

        D Offline
        D Offline
        DRHuff
        wrote on last edited by
        #3

        Numeric sorting. How old school!

        I, for one, like Roman Numerals.

        1 Reply Last reply
        0
        • L Lost User

          ... that new people struggle? A questioner complained that their SortCompare method in a DataGridView did not work. Looking at the code it was clear that they were sorting integer values as strings, which means alphabetic rather than numeric order. So, I went to MSDN to check the documentation, only to discover that OP had copied the code verbatim. And every sample pertaining to sorting in a DataGridView had exactly the same bad code: DataGridViewSortCompareEventArgs Class (System.Windows.Forms) | Microsoft Docs[^].

          N Offline
          N Offline
          Nicholas Marty
          wrote on last edited by
          #4

          Nothing in the docs says that the cells they are comparing contain integers Also directly above the code sample

          MSDN

          This example is part of a larger example provided in How to: Customize Sorting in the Windows Forms DataGridView Control | Microsoft Docs[^]

          The larger example code contains a DataGridView with three string columns.

          L 1 Reply Last reply
          0
          • L Lost User

            ... that new people struggle? A questioner complained that their SortCompare method in a DataGridView did not work. Looking at the code it was clear that they were sorting integer values as strings, which means alphabetic rather than numeric order. So, I went to MSDN to check the documentation, only to discover that OP had copied the code verbatim. And every sample pertaining to sorting in a DataGridView had exactly the same bad code: DataGridViewSortCompareEventArgs Class (System.Windows.Forms) | Microsoft Docs[^].

            Mike HankeyM Offline
            Mike HankeyM Offline
            Mike Hankey
            wrote on last edited by
            #5

            A plot to flesh out plagiarists?

            Technician 1. A person that fixes stuff you can't. 2. One who does precision guesswork based on unreliable data provided by those of questionable knowledge. JaxCoder.com

            1 Reply Last reply
            0
            • N Nicholas Marty

              Nothing in the docs says that the cells they are comparing contain integers Also directly above the code sample

              MSDN

              This example is part of a larger example provided in How to: Customize Sorting in the Windows Forms DataGridView Control | Microsoft Docs[^]

              The larger example code contains a DataGridView with three string columns.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Yes, and you understand that. However, the main sample shows the first column labelled "ID" containing numbers (even though as string values). So a relatively inexperienced user would assume that sorting by ID would list numbers 4 and 5 before 11 and 12, rather than the other way round.

              1 Reply Last reply
              0
              • L Lost User

                ... that new people struggle? A questioner complained that their SortCompare method in a DataGridView did not work. Looking at the code it was clear that they were sorting integer values as strings, which means alphabetic rather than numeric order. So, I went to MSDN to check the documentation, only to discover that OP had copied the code verbatim. And every sample pertaining to sorting in a DataGridView had exactly the same bad code: DataGridViewSortCompareEventArgs Class (System.Windows.Forms) | Microsoft Docs[^].

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Picture implies he wants to number the rows in the gutter. I don't see how sorting is going to help with that :)

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                L 1 Reply Last reply
                0
                • L Lost User

                  Picture implies he wants to number the rows in the gutter. I don't see how sorting is going to help with that :)

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  As usual the pictures don't quite explain what he wants, and requests for details never get answered.

                  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