Click here to Skip to main content
15,914,398 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sorting Array of objects [modified] Pin
Rizwan Rathore23-May-06 14:29
Rizwan Rathore23-May-06 14:29 
GeneralRe: Sorting Array of objects [modified] Pin
Robert Rohde23-May-06 19:44
Robert Rohde23-May-06 19:44 
GeneralRe: Sorting Array of objects [modified] Pin
Rizwan Rathore23-May-06 22:09
Rizwan Rathore23-May-06 22:09 
GeneralRe: Sorting Array of objects [modified] Pin
Robert Rohde23-May-06 22:24
Robert Rohde23-May-06 22:24 
GeneralRe: Sorting Array of objects [modified] Pin
Rizwan Rathore23-May-06 23:05
Rizwan Rathore23-May-06 23:05 
GeneralRe: Sorting Array of objects [modified] Pin
Robert Rohde23-May-06 23:13
Robert Rohde23-May-06 23:13 
GeneralRe: Sorting Array of objects [modified] Pin
Rizwan Rathore23-May-06 23:40
Rizwan Rathore23-May-06 23:40 
GeneralRe: Sorting Array of objects [modified] Pin
Robert Rohde24-May-06 0:12
Robert Rohde24-May-06 0:12 
Several things:
1. In the first snippet the CompareTo should look like the following:
public int CompareTo(object obj)
{
   Terminology w = (Terminology) obj;
   return( this.term.CompareTo( w.term ));
}

In your implementation you compared w.term with itself.

2. The following part isn't needed (as far as I can see from your snippets):
private string strValue = "term";
public int CompareTo(object obj)
{
   Terminology w = (Terminology) obj;
   return( strValue.CompareTo( w.term ));
}
}


3. If you are getting such an error when j is 0 than my previous assumption that there are null values in your array seems right. The first element of the word array seems to be null.
You could verify this for example with the following code:
for(int j = 0; j < Terminology.count-1; j++)
{
   if (word[j] == null)
      MessageBox.Show("word array at index " + j + " is null");
   else if (word[j].term == null)
      MessageBox.Show("term property in word array at index " + j + " is null");
   sw.Write(j+1 +"\t"+word[j].term.PadRight(20,' '));
}

GeneralRe: Sorting Array of objects [modified] Pin
Rizwan Rathore24-May-06 0:54
Rizwan Rathore24-May-06 0:54 
AnswerRe: Sorting Array of objects Pin
BoneSoft23-May-06 4:20
BoneSoft23-May-06 4:20 
GeneralRe: Sorting Array of objects Pin
Rizwan Rathore23-May-06 14:11
Rizwan Rathore23-May-06 14:11 
GeneralRe: Sorting Array of objects Pin
BoneSoft23-May-06 15:10
BoneSoft23-May-06 15:10 
GeneralRe: Sorting Array of objects Pin
Robert Rohde23-May-06 19:42
Robert Rohde23-May-06 19:42 
GeneralRe: Sorting Array of objects Pin
BoneSoft24-May-06 1:31
BoneSoft24-May-06 1:31 
GeneralRe: Sorting Array of objects Pin
Rizwan Rathore23-May-06 21:13
Rizwan Rathore23-May-06 21:13 
QuestionNovell GroupWise Pin
NewbieDude22-May-06 23:32
NewbieDude22-May-06 23:32 
QuestionListView.ShowGroups=TRUE [modified] Pin
Greeky22-May-06 23:21
Greeky22-May-06 23:21 
QuestionProblems with HDC Pin
__makaveli__22-May-06 23:16
__makaveli__22-May-06 23:16 
QuestionHow to view a Flash file in C# Pin
nps_ltv22-May-06 23:12
nps_ltv22-May-06 23:12 
AnswerRe: How to view a Flash file in C# Pin
Saqib Mehmood23-May-06 1:57
Saqib Mehmood23-May-06 1:57 
GeneralRe: How to view a Flash file in C# Pin
nps_ltv25-May-06 0:22
nps_ltv25-May-06 0:22 
GeneralRe: How to view a Flash file in C# Pin
Saqib Mehmood25-May-06 0:40
Saqib Mehmood25-May-06 0:40 
Questionset tile ,author name to image in c# Pin
sreesiri22-May-06 23:00
sreesiri22-May-06 23:00 
AnswerRe: set tile ,author name to image in c# Pin
stancrm22-May-06 23:27
stancrm22-May-06 23:27 
GeneralRe: set tile ,author name to image in c# Pin
sreesiri23-May-06 21:02
sreesiri23-May-06 21:02 

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.