Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
QuestionHow to insert a control in grid view - C# windows [modified] Pin
NarVish16-Apr-08 23:25
NarVish16-Apr-08 23:25 
AnswerRe: How to insert a control in grid view - C# windows Pin
ali_reza_zareian17-Apr-08 0:21
ali_reza_zareian17-Apr-08 0:21 
Generalsingle selection across ListBoxes Pin
Maddie from Dartford16-Apr-08 22:57
Maddie from Dartford16-Apr-08 22:57 
GeneralRe: single selection across ListBoxes Pin
Simon P Stevens16-Apr-08 23:37
Simon P Stevens16-Apr-08 23:37 
GeneralRe: single selection across ListBoxes Pin
Maddie from Dartford16-Apr-08 23:53
Maddie from Dartford16-Apr-08 23:53 
GeneralRe: single selection across ListBoxes Pin
Simon P Stevens17-Apr-08 0:18
Simon P Stevens17-Apr-08 0:18 
QuestionProgram with SQL Support Pin
m1n1me16-Apr-08 22:57
m1n1me16-Apr-08 22:57 
GeneralRe: Program with SQL Support Pin
ali_reza_zareian17-Apr-08 0:28
ali_reza_zareian17-Apr-08 0:28 
GeneralRe: Program with SQL Support Pin
m1n1me17-Apr-08 18:44
m1n1me17-Apr-08 18:44 
General'System.StackOverflowException' [modified] Pin
cocoonwls16-Apr-08 22:52
cocoonwls16-Apr-08 22:52 
GeneralRe: 'System.StackOverflowException' Pin
Simon P Stevens16-Apr-08 23:34
Simon P Stevens16-Apr-08 23:34 
GeneralRe: 'System.StackOverflowException' Pin
cocoonwls17-Apr-08 0:07
cocoonwls17-Apr-08 0:07 
GeneralRe: 'System.StackOverflowException' Pin
Simon P Stevens17-Apr-08 0:14
Simon P Stevens17-Apr-08 0:14 
GeneralQyery Builder Pin
Muneer Safi16-Apr-08 22:45
Muneer Safi16-Apr-08 22:45 
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
mvePete 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 

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.