Click here to Skip to main content
15,868,007 members
Home / Discussions / C#
   

C#

 
GeneralRe: Password CAPS not Checking in my code Pin
Dave Kreskowiak23-Mar-22 2:46
mveDave Kreskowiak23-Mar-22 2:46 
GeneralRe: Password CAPS not Checking in my code Pin
N Mohamed rafi25-Mar-22 22:56
N Mohamed rafi25-Mar-22 22:56 
GeneralRe: Password CAPS not Checking in my code Pin
Dave Kreskowiak26-Mar-22 9:53
mveDave Kreskowiak26-Mar-22 9:53 
QuestionMysql Query Error Pin
N Mohamed rafi22-Mar-22 1:53
N Mohamed rafi22-Mar-22 1:53 
AnswerRe: Mysql Query Error Pin
Dave Kreskowiak22-Mar-22 2:02
mveDave Kreskowiak22-Mar-22 2:02 
AnswerRe: Mysql Query Error Pin
OriginalGriff22-Mar-22 2:40
mveOriginalGriff22-Mar-22 2:40 
Questionhow sort datgridview or listview like windows explorer Pin
Le@rner21-Mar-22 20:01
Le@rner21-Mar-22 20:01 
AnswerRe: how sort datgridview or listview like windows explorer Pin
OriginalGriff21-Mar-22 21:12
mveOriginalGriff21-Mar-22 21:12 
That's the correct sorting, for your data - the problem is deeper than that and probably requires changes elsewhere.

When you sort numbers, you expect this order: 1, 2, 3, ... 9, 10, 11, ... 19, 20 ...
But when you sort strings, the whole comparison is based on the first different pair of characters you encounter in the two strings. So if you compare "APPLE" with "APART"it does this:
1) Compare index [0]: 'A' and 'A'. Same. Continue
2) Compare index [1]: 'P' and 'P'. Same. Continue
3) Compare index [2]: 'P' and 'A'. Different: Since 'A' is less than 'P' return the second string as the "lowest" value.
Indexes [3] and above aren't even looked at.

That's all fine and dandy, except if you are comparing string values and expecting numeric ordering, because the string ordering is used regardless of the string content and the order goes:
1, 10, 11, ... 19, 2, 20, 21, ... 29, 3, 30, ...
This problem gets even worse with date based string data!

So what you actually need to do is look to the source of your data and find out why it is a string rather than a numeric value, and correct that. Often, it's due to bad design in a DB where all the data is stored as strings because that was easy to do and caused no errors when bad numbers or bad dates where INSERTed - but the best way to fix this is to fix the DB design so you store numbers in numeric fields, and dates in date based fields.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: how sort datgridview or listview like windows explorer Pin
Le@rner22-Mar-22 1:20
Le@rner22-Mar-22 1:20 
GeneralRe: how sort datgridview or listview like windows explorer Pin
Dave Kreskowiak22-Mar-22 1:50
mveDave Kreskowiak22-Mar-22 1:50 
AnswerRe: how sort datgridview or listview like windows explorer Pin
Richard Deeming21-Mar-22 22:32
mveRichard Deeming21-Mar-22 22:32 
GeneralRe: how sort datgridview or listview like windows explorer Pin
Le@rner22-Mar-22 2:00
Le@rner22-Mar-22 2:00 
GeneralRe: how sort datgridview or listview like windows explorer Pin
Le@rner28-Mar-22 1:36
Le@rner28-Mar-22 1:36 
GeneralRe: how sort datgridview or listview like windows explorer Pin
Richard Deeming28-Mar-22 21:45
mveRichard Deeming28-Mar-22 21:45 
AnswerRe: how sort datgridview or listview like windows explorer Pin
RobertSF26-Mar-22 13:32
professionalRobertSF26-Mar-22 13:32 
GeneralC# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 16:34
N Mohamed rafi21-Mar-22 16:34 
SuggestionRe: C# to Mysql Login code Error Pin
Richard Deeming21-Mar-22 22:26
mveRichard Deeming21-Mar-22 22:26 
AnswerRe: C# to Mysql Login code Error Pin
Richard Deeming21-Mar-22 22:28
mveRichard Deeming21-Mar-22 22:28 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 22:33
N Mohamed rafi21-Mar-22 22:33 
GeneralRe: C# to Mysql Login code Error Pin
Richard Deeming21-Mar-22 22:38
mveRichard Deeming21-Mar-22 22:38 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 22:43
N Mohamed rafi21-Mar-22 22:43 
GeneralRe: C# to Mysql Login code Error Pin
Richard Deeming21-Mar-22 23:03
mveRichard Deeming21-Mar-22 23:03 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:20
N Mohamed rafi21-Mar-22 23:20 
GeneralRe: C# to Mysql Login code Error Pin
Richard Deeming21-Mar-22 23:25
mveRichard Deeming21-Mar-22 23:25 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:34
N Mohamed rafi21-Mar-22 23:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.