Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
QuestionComparing an Image Pin
Gareth H6-Sep-07 8:38
Gareth H6-Sep-07 8:38 
AnswerRe: Comparing an Image Pin
Rick van Woudenberg6-Sep-07 8:57
Rick van Woudenberg6-Sep-07 8:57 
AnswerRe: Comparing an Image Pin
Luc Pattyn6-Sep-07 9:03
sitebuilderLuc Pattyn6-Sep-07 9:03 
AnswerRe: Comparing an Image Pin
Judah Gabriel Himango6-Sep-07 9:05
sponsorJudah Gabriel Himango6-Sep-07 9:05 
QuestionSorting Multiple Properties Pin
DaveyM696-Sep-07 7:45
professionalDaveyM696-Sep-07 7:45 
AnswerRe: Sorting Multiple Properties [modified] Pin
Luc Pattyn6-Sep-07 7:51
sitebuilderLuc Pattyn6-Sep-07 7:51 
GeneralRe: Sorting Multiple Properties Pin
DaveyM696-Sep-07 8:05
professionalDaveyM696-Sep-07 8:05 
GeneralRe: Sorting Multiple Properties Pin
TJoe6-Sep-07 8:16
TJoe6-Sep-07 8:16 
You don't want to use the '-' operator. You can compare string using String.Compare(str1, str2). This returns an integer that would give you proper sorting. You can ignore case if you want by using String.Compare(str1, str2, true).

So the code would be something like:

Int32 order = String.Compare(p1.FirstName, p2.FirstName, true);

// If the first names match, then check last name
if (0 == order)
    order = String.Compare(p1.LastName, p2.LastName, true);

return order;


Take care,
Tom

-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com

GeneralRe: Sorting Multiple Properties Pin
Luc Pattyn6-Sep-07 8:17
sitebuilderLuc Pattyn6-Sep-07 8:17 
GeneralRe: Sorting Multiple Properties Pin
DaveyM696-Sep-07 8:25
professionalDaveyM696-Sep-07 8:25 
GeneralRe: Sorting Multiple Properties Pin
Luc Pattyn6-Sep-07 8:32
sitebuilderLuc Pattyn6-Sep-07 8:32 
Questionclasses.. Pin
rcwoods6-Sep-07 6:50
rcwoods6-Sep-07 6:50 
AnswerRe: classes.. Pin
Colin Angus Mackay6-Sep-07 6:58
Colin Angus Mackay6-Sep-07 6:58 
GeneralRe: classes.. [modified] Pin
Jason Hanford-Smith6-Sep-07 7:21
Jason Hanford-Smith6-Sep-07 7:21 
GeneralRe: classes.. Pin
Colin Angus Mackay6-Sep-07 9:34
Colin Angus Mackay6-Sep-07 9:34 
GeneralRe: classes.. Pin
Jason Hanford-Smith6-Sep-07 9:37
Jason Hanford-Smith6-Sep-07 9:37 
GeneralRe: classes.. Pin
Larantz6-Sep-07 10:03
Larantz6-Sep-07 10:03 
GeneralRe: classes.. Pin
Colin Angus Mackay6-Sep-07 10:18
Colin Angus Mackay6-Sep-07 10:18 
GeneralRe: classes.. Pin
Larantz6-Sep-07 10:21
Larantz6-Sep-07 10:21 
GeneralRe: classes.. Pin
Colin Angus Mackay6-Sep-07 11:12
Colin Angus Mackay6-Sep-07 11:12 
GeneralRe: classes.. Pin
Colin Angus Mackay6-Sep-07 13:33
Colin Angus Mackay6-Sep-07 13:33 
GeneralRe: classes.. Pin
martin_hughes6-Sep-07 7:47
martin_hughes6-Sep-07 7:47 
GeneralRe: classes.. Pin
Luc Pattyn6-Sep-07 7:55
sitebuilderLuc Pattyn6-Sep-07 7:55 
GeneralRe: classes.. Pin
martin_hughes6-Sep-07 8:05
martin_hughes6-Sep-07 8:05 
QuestionHelp panel position in PropertyGrid Pin
rbuchana6-Sep-07 6:46
rbuchana6-Sep-07 6:46 

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.