VB.Net Combobox Reverse Order

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 2
Reputation: ScatterMap is an unknown quantity at this point 
Solved Threads: 0
ScatterMap ScatterMap is offline Offline
Newbie Poster

VB.Net Combobox Reverse Order

 
0
  #1
Apr 27th, 2007
How do i reverse the order of a combobox. I'm currently loading cboItems.items.add (reader.readline) from a .txt document using streamreader.

After the items are loaded into the Combobox, i want to reverse their order from Bottom to Top.

Is that possible?...
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: VB.Net Combobox Reverse Order

 
0
  #2
Apr 27th, 2007
Yes it is possible.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: VB.Net Combobox Reverse Order

 
0
  #3
Apr 27th, 2007
Use an ArrayList, then iterate backwards

  1. using System;
  2. using System.Collections;
  3. using System.IO;
  4.  
  5. namespace SortedList
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. ArrayList stringList = new ArrayList();
  12.  
  13. StreamReader stringReader = new StreamReader("c:\\OptionList.txt");
  14. string option = "";
  15.  
  16. while ((option = stringReader.ReadLine()) != null)
  17. {
  18. stringList.Add(option);
  19. }
  20.  
  21. stringReader.Close();
  22. stringReader.Dispose();
  23.  
  24. stringList.TrimToSize();
  25.  
  26. for (int i = stringList.Count - 1; i >= 0; --i)
  27. {
  28. Console.WriteLine(stringList[i]);
  29. }
  30.  
  31. Console.ReadLine();
  32. }
  33. }
  34. }

You'll have to translate to VB syntax cos I can't stand VB syntax it makes my teeth jangle! And besides gotta leave you with something to do.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC