Click here to Skip to main content
15,911,142 members
Home / Discussions / C#
   

C#

 
Questiontwo filters in List class find function Pin
Sonia Gupta6-Mar-08 23:23
Sonia Gupta6-Mar-08 23:23 
GeneralRe: two filters in List class find function Pin
Pete O'Hanlon6-Mar-08 23:32
mvePete O'Hanlon6-Mar-08 23:32 
GeneralRe: two filters in List class find function Pin
Giorgi Dalakishvili6-Mar-08 23:34
mentorGiorgi Dalakishvili6-Mar-08 23:34 
GeneralRe: two filters in List class find function Pin
J4amieC7-Mar-08 2:25
J4amieC7-Mar-08 2:25 
GeneralRe: two filters in List class find function Pin
Pete O'Hanlon7-Mar-08 3:37
mvePete O'Hanlon7-Mar-08 3:37 
GeneralRe: two filters in List class find function Pin
J4amieC7-Mar-08 4:20
J4amieC7-Mar-08 4:20 
GeneralRe: two filters in List class find function Pin
Pete O'Hanlon7-Mar-08 4:42
mvePete O'Hanlon7-Mar-08 4:42 
Generalproblem in setting datasource of a usercontrol Pin
saneng6-Mar-08 23:03
saneng6-Mar-08 23:03 
Questionsorting of a string column Pin
Sonia Gupta6-Mar-08 22:58
Sonia Gupta6-Mar-08 22:58 
GeneralRe: sorting of a string column Pin
Laddie6-Mar-08 23:11
Laddie6-Mar-08 23:11 
GeneralRe: sorting of a string column Pin
Pete O'Hanlon6-Mar-08 23:29
mvePete O'Hanlon6-Mar-08 23:29 
QuestionRe: sorting of a string column Pin
Sonia Gupta6-Mar-08 23:34
Sonia Gupta6-Mar-08 23:34 
GeneralRe: sorting of a string column PinPopular
Pete O'Hanlon6-Mar-08 23:37
mvePete O'Hanlon6-Mar-08 23:37 
QuestionRe: sorting of a string column Pin
Leyu7-Mar-08 0:31
Leyu7-Mar-08 0:31 
GeneralRe: sorting of a string column Pin
Luc Pattyn7-Mar-08 1:28
sitebuilderLuc Pattyn7-Mar-08 1:28 
Hi,

I don't think SQL offers the required ordering.

The "natural sort order" as used for file names by Windows Explorer is available through
P/Invoke, so you can implement an IComparer interface like this:

using System.Runtime.InteropServices;	// DllImport
 
/// <summary>
/// Compares two strings while ignoring case and treating sequences of digits as numbers.
/// (static version).
/// </summary>
public static int Compare(string s1, string s2) {
	if (s1!=null && s2!=null) return StrCmpLogicalW(s1, s2);
	else return string.Compare(s1, s2, true);
}
 
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
private static extern int StrCmpLogicalW(string s1, string s2);


I do not know how you could apply the above to database-based data; I would guess
you need to first fill a DataTable, then somehow get that sorted using the IComparer object.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.


GeneralRe: sorting of a string column [modified] Pin
PIEBALDconsult7-Mar-08 6:24
mvePIEBALDconsult7-Mar-08 6:24 
GeneralAll Textbox Should be Replace with Zero Pin
M Riaz Bashir6-Mar-08 22:41
M Riaz Bashir6-Mar-08 22:41 
GeneralRe: All Textbox Should be Replace with Zero Pin
Giorgi Dalakishvili6-Mar-08 23:14
mentorGiorgi Dalakishvili6-Mar-08 23:14 
GeneralSecuring HTTP Pin
Lucian.Palcu6-Mar-08 22:27
Lucian.Palcu6-Mar-08 22:27 
GeneralRe: Securing HTTP Pin
snorkie7-Mar-08 9:58
professionalsnorkie7-Mar-08 9:58 
GeneralTo generate a pop up from windows service.. Pin
ag466776-Mar-08 21:40
ag466776-Mar-08 21:40 
GeneralRe: To generate a pop up from windows service.. Pin
Leyu6-Mar-08 21:57
Leyu6-Mar-08 21:57 
GeneralRe: To generate a pop up from windows service.. Pin
ag466776-Mar-08 22:13
ag466776-Mar-08 22:13 
GeneralRe: To generate a pop up from windows service.. Pin
Laddie6-Mar-08 22:14
Laddie6-Mar-08 22:14 
Questionfind function of List Pin
Sonia Gupta6-Mar-08 21:37
Sonia Gupta6-Mar-08 21:37 

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.