Windows Develop Bookmark and Share   
 index > Windows Forms General > Displaying a Collection
 

Displaying a Collection

Hello All,

Please consider the collection shown below.

namespace CebuanoTeacher
{
   [Serializable]
   public enum PartsOfSpeechEnum
   {
      NOUN,
      VERB,
      ADJECTIVE,
      ADVERB,
      PREPOSITION,
      CONJUNCTION,
      PRONOUN,
      PARTICLE,
      LINKER,
      PSEUDOVERB
   }

   [Serializable]
   public class CebuanoDictionaryKey
   {
      public string Word { get; set; }
      public PartsOfSpeechEnum PartOfSpeech { get; set; }
   }

   [Serializable]
   public class CebuanoDictionaryValue
   {
      public List<string> EnglishEquivalents { get; set; }
      public bool Mastered { get; set; }
   }

   [Serializable]
   public class CebuanoDictionary :
         SortedDictionary<CebuanoDictionaryKey, CebuanoDictionaryValue>
   {
   }
}
I'd like to display the contents of a CebuanoDictionary. Each row would correspond to one word and would have four columns: the word itself (a string), the part of speech (which is also just a string), the English eqivalents (more on this in a moment), and either "Yes" or "No" string to indicate whether the user believes he has mastered that word. Note that two of these display values come from a dictionary key and the other two come from a dictionary value.

The English equivalents would also be just a string. This string would list all of the equivalent English words separated by a \n. So, a row can become tall if there are several equivalent words.

Here's an idea of what I'd like the dislay to look like:

amo          noun     monkey     Yes
                            boss
sumbag     verb     punch         Yes

I hope the above displays correctly (it does as I sit here and edit it) or things might get confusing.

I'm trying to decide which control makes the most sense. I think I've rules out ListBox since it doesn't seem to support multiple columns (the MultiColumn property doesn't do what I want it to). I'm also looking at ListControl and ListView.

One final requirement: I need to be able to sort by a column by clicking on that column's header.

What would people suggest as the best way to get the type of presentation I seek?

Thanks,
Dave
dtheese  12 hours 53 minutes ago
Looks like a grid.  Use ListView with View = Details or use a DataGridView.

Hans Passant.
nobugz  9 hours 57 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• private static methods vs private non-static methods?
• PropertyGrid not catching mouse events
• Webbrowser Zooming
• How do i create a Sport Season Scheduler in C# or C++?
• HOW TO: attach PreProcessMessage to windows form or control
• C# Problem foreach
• How to display controls on the fly
• Setup projects putting too many files in the Program Start menu - how to fix
• WPF & LINQ on .net 2.0 framework sp1?
• mouse events from a non-client area of a control