Click here to Skip to main content
15,921,250 members
Home / Discussions / C#
   

C#

 
GeneralRe: Editable Combobox Pin
OldSchoolToC#26-Mar-09 14:07
OldSchoolToC#26-Mar-09 14:07 
GeneralRe: Editable Combobox Pin
Luc Pattyn26-Mar-09 15:38
sitebuilderLuc Pattyn26-Mar-09 15:38 
AnswerRe: Editable Combobox Pin
dybs26-Mar-09 16:47
dybs26-Mar-09 16:47 
GeneralRe: Editable Combobox Pin
OldSchoolToC#26-Mar-09 16:54
OldSchoolToC#26-Mar-09 16:54 
GeneralRe: Editable Combobox Pin
Dave Kreskowiak26-Mar-09 18:10
mveDave Kreskowiak26-Mar-09 18:10 
GeneralRe: Editable Combobox Pin
dybs27-Mar-09 15:43
dybs27-Mar-09 15:43 
GeneralRe: Editable Combobox Pin
jaypatel51227-Mar-09 6:05
jaypatel51227-Mar-09 6:05 
QuestionVery Large Sets of Data - Millions of Rows - how to do it? Pin
tjawed26-Mar-09 10:25
tjawed26-Mar-09 10:25 
AnswerRe: Very Large Sets of Data - Millions of Rows - how to do it? Pin
Eddy Vluggen26-Mar-09 10:32
professionalEddy Vluggen26-Mar-09 10:32 
AnswerRe: Very Large Sets of Data - Millions of Rows - how to do it? Pin
Skymir26-Mar-09 10:49
Skymir26-Mar-09 10:49 
QuestionParsing and output the results Pin
Ayaz Niazi26-Mar-09 9:10
Ayaz Niazi26-Mar-09 9:10 
AnswerRe: Parsing and output the results Pin
Luc Pattyn26-Mar-09 10:01
sitebuilderLuc Pattyn26-Mar-09 10:01 
QuestionDeployment with SQL Express 2005 Pin
Searril26-Mar-09 8:54
Searril26-Mar-09 8:54 
AnswerRe: Deployment with SQL Express 2005 Pin
Searril27-Mar-09 1:35
Searril27-Mar-09 1:35 
QuestionOpen drop down list Pin
Chazzysb26-Mar-09 8:52
Chazzysb26-Mar-09 8:52 
AnswerRe: Open drop down list Pin
Jimmanuel26-Mar-09 9:22
Jimmanuel26-Mar-09 9:22 
GeneralRe: Open drop down list Pin
Chazzysb26-Mar-09 10:09
Chazzysb26-Mar-09 10:09 
QuestionCasting socket data to a type Pin
FoxholeWilly26-Mar-09 8:26
FoxholeWilly26-Mar-09 8:26 
AnswerRe: Casting socket data to a type Pin
Eddy Vluggen26-Mar-09 9:26
professionalEddy Vluggen26-Mar-09 9:26 
QuestionListBox Sorting issue (inaccurate) Pin
dfb7826-Mar-09 8:10
dfb7826-Mar-09 8:10 
I am having a problem with sorting a multi-column ListBox. For simplicity, let's say I only have 3 columns: Id, Score, and TotalPoints. I have implemented a Compare method from the IComparer interface that looks like this:

public int Compare(object x, object y)
{
   int compareResult;
   ListViewItem listviewX, listviewY;

   // Cast the objects to be compared to ListViewItem objects
   listviewX = (ListViewItem)x;
   listviewY = (ListViewItem)y;

   // Compare the two items
   compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text, listviewY.SubItems[ColumnToSort].Text);
   // Calculate correct return value based on object comparison
   if (OrderOfSort == SortOrder.Ascending)
   {
      // Ascending sort is selected, return normal result of compare operation
      return compareResult;
   }
   else if (OrderOfSort == SortOrder.Descending)
   {
      // Descending sort is selected, return negative result of compare operation
      return (-compareResult);
   }
   else
   {
      // Return '0' to indicate they are equal
      return 0;
   }
}


The sorting is inaccurate though. For example, let's say I have 3 rows, and the Scores are 10, 11, and 2. When I sort the column, it displays 10, 11, then 2...not 11, 10, 2. I am pretty sure it has something to do with the number of digits in the string, but I have no idea how to resolve it. For the most part the sorting works, just this little kink. Any help would be greatly appreciated.


Thanks
AnswerRe: ListBox Sorting issue (inaccurate) Pin
Yusuf26-Mar-09 8:54
Yusuf26-Mar-09 8:54 
GeneralRe: ListBox Sorting issue (inaccurate) Pin
dfb7826-Mar-09 9:41
dfb7826-Mar-09 9:41 
AnswerRe: ListBox Sorting issue (inaccurate) Pin
Luc Pattyn26-Mar-09 8:55
sitebuilderLuc Pattyn26-Mar-09 8:55 
Questioncalculator Pin
the exile26-Mar-09 8:04
the exile26-Mar-09 8:04 
AnswerRe: calculator Pin
Eddy Vluggen26-Mar-09 8:08
professionalEddy Vluggen26-Mar-09 8:08 

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.