Click here to Skip to main content
15,867,686 members
Home / Discussions / C#
   

C#

 
QuestionRe: Qyery Builder Pin
ali_reza_zareian17-Apr-08 0:31
ali_reza_zareian17-Apr-08 0:31 
GeneralRe: Qyery Builder Pin
Muneer Safi17-Apr-08 0:42
Muneer Safi17-Apr-08 0:42 
GeneralRe: Qyery Builder Pin
Pete O'Hanlon17-Apr-08 1:30
subeditorPete O'Hanlon17-Apr-08 1:30 
QuestionMultiple DataKey Pin
frian_sf16-Apr-08 22:42
frian_sf16-Apr-08 22:42 
GeneralRe: Multiple DataKey Pin
Reelix17-Apr-08 19:48
Reelix17-Apr-08 19:48 
GeneralZip multiple files Pin
JustRonald16-Apr-08 22:35
JustRonald16-Apr-08 22:35 
QuestionControlCollection Question Pin
Programm3r16-Apr-08 22:26
Programm3r16-Apr-08 22:26 
AnswerRe: ControlCollection Question Pin
Simon P Stevens16-Apr-08 23:25
Simon P Stevens16-Apr-08 23:25 
Programm3r wrote:
Am I doing something wrong


No. The ControlCollection class implements IList, which means it maintains the order of it's items based on the order they were added in to the collection. If you look in the forms InitializeComponent method, you will see the controls being added to the collection. This is the order they will be coming out in when you foreach over the collection. (Don't ask me how the designer decides on the order to put the controls in the collection because I don't know)

If this isn't the order you want them to come out in, you need to maintain your own collection of controls and sort them yourself.

You could have use a generic SortedList. and add all your controls to the sorted list.

SortedList<string, control=""> myListOfControls;
myListOfControls.Add(button1.Name, button1);
myListOfControls.Add(button2.Name, button2);
myListOfControls.Add(button3.Name, button3);
</string,>


This sorted list would now hold those button controls sorted into order by their names. When you foreached across myListOfControls, you'll get them out in order of name now.

Does that help?


Simon

GeneralRe: ControlCollection Question Pin
Programm3r17-Apr-08 19:31
Programm3r17-Apr-08 19:31 
GeneralFetching meta data of MS Office files [modified] Pin
sachinkalse16-Apr-08 21:36
sachinkalse16-Apr-08 21:36 
GeneralRe: Fetching meta data of MS Office files Pin
Member 769142521-Feb-11 1:10
Member 769142521-Feb-11 1:10 
QuestionHow to open a XML file without validating? Pin
Hariharan210516-Apr-08 20:25
Hariharan210516-Apr-08 20:25 
AnswerRe: How to open a XML file without validating? Pin
pmarfleet16-Apr-08 22:39
pmarfleet16-Apr-08 22:39 
GeneralRe: How to open a XML file without validating? Pin
Hariharan210517-Apr-08 3:30
Hariharan210517-Apr-08 3:30 
General[Message Deleted] Pin
wwwxyz16-Apr-08 20:18
wwwxyz16-Apr-08 20:18 
GeneralRe: write to a txt file Pin
Reelix16-Apr-08 20:36
Reelix16-Apr-08 20:36 
GeneralRe: write to a txt file Pin
wwwxyz17-Apr-08 6:33
wwwxyz17-Apr-08 6:33 
GeneralRe: write to a txt file Pin
John_Adams16-Apr-08 20:40
John_Adams16-Apr-08 20:40 
GeneralRe: write to a txt file Pin
phannon8616-Apr-08 21:59
professionalphannon8616-Apr-08 21:59 
GeneralDownloading problem using c sharp Pin
Kashif Sabir16-Apr-08 19:24
Kashif Sabir16-Apr-08 19:24 
GeneralRe: Downloading problem using c sharp Pin
Expert Coming16-Apr-08 19:39
Expert Coming16-Apr-08 19:39 
QuestionTechnology Choice? Pin
Expert Coming16-Apr-08 19:23
Expert Coming16-Apr-08 19:23 
AnswerRe: Technology Choice? Pin
Thomas Stockwell17-Apr-08 1:16
professionalThomas Stockwell17-Apr-08 1:16 
QuestionHow to get the last day of the month. Pin
dougins16-Apr-08 19:15
dougins16-Apr-08 19:15 
GeneralRe: How to get the last day of the month. Pin
Expert Coming16-Apr-08 19:19
Expert Coming16-Apr-08 19:19 

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.