Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
QuestionSometing wrong in my code,can you check it?thx~! [modified] Pin
franva13-Dec-08 0:49
franva13-Dec-08 0:49 
Questionhow to retrive the excutions file of a MimeType? Pin
leeoze13-Dec-08 0:03
leeoze13-Dec-08 0:03 
GeneralRe: how to retrive the excutions file of a MimeType? Pin
Luc Pattyn13-Dec-08 0:33
sitebuilderLuc Pattyn13-Dec-08 0:33 
AnswerRe: how to retrive the excutions file of a MimeType? Pin
Giorgi Dalakishvili13-Dec-08 1:20
mentorGiorgi Dalakishvili13-Dec-08 1:20 
GeneralRe: how to retrive the excutions file of a MimeType? -> found the answer Pin
leeoze14-Dec-08 9:50
leeoze14-Dec-08 9:50 
QuestionArray List Problem Pin
ais0712-Dec-08 21:49
ais0712-Dec-08 21:49 
AnswerRe: Array List Problem Pin
CodingYoshi12-Dec-08 22:01
CodingYoshi12-Dec-08 22:01 
GeneralRe: Array List Problem Pin
Luc Pattyn12-Dec-08 22:50
sitebuilderLuc Pattyn12-Dec-08 22:50 
Hi,

you can store anything you like in an ArrayList or any other kind of collection (Hashtable, SortedList, ...).

you can store all kinds of objects with a common base type (such as Control) in a List of that type, or any other kind of collection capable of holding your base type (Dictionary, ...).

You probably don't have to create a new collection since each Control (and hence each Form) already has a collection holding ALL its Controls.

Example: if you want to do something to all the Buttons on myForm, this would be sufficient:

foreach(Control c in myForm.Controls) {
    Button btn=c as Button;
    if (btn!=null) {
        // whatever it is you want to do to buttons
        btn.PerformClick();
    }
}


Warning: a foreach on an enumerator will not allow you to modify the collection, so the above loop would not allow you to add or remove buttons; you would need a for or while loop for that.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


GeneralRe: Array List Problem Pin
ais0712-Dec-08 23:03
ais0712-Dec-08 23:03 
GeneralRe: Array List Problem Pin
Mycroft Holmes12-Dec-08 23:13
professionalMycroft Holmes12-Dec-08 23:13 
AnswerRe: Array List Problem Pin
Brij12-Dec-08 23:09
mentorBrij12-Dec-08 23:09 
GeneralRe: Array List Problem Pin
Lev Danielyan13-Dec-08 0:11
Lev Danielyan13-Dec-08 0:11 
GeneralRe: Array List Problem Pin
#realJSOP13-Dec-08 0:21
mve#realJSOP13-Dec-08 0:21 
AnswerRe: Array List Problem Pin
#realJSOP13-Dec-08 0:19
mve#realJSOP13-Dec-08 0:19 
QuestionIs using a DLL not open source? Pin
adeydas12-Dec-08 21:22
adeydas12-Dec-08 21:22 
AnswerRe: Is using a DLL not open source? Pin
Mark Churchill13-Dec-08 2:28
Mark Churchill13-Dec-08 2:28 
AnswerRe: Is using a DLL not open source? Pin
PIEBALDconsult13-Dec-08 5:07
mvePIEBALDconsult13-Dec-08 5:07 
QuestionHow to Read/Write DBF file In C# use IO/Stream (not OLEDB) Pin
tinh cau12-Dec-08 20:52
tinh cau12-Dec-08 20:52 
AnswerRe: How to Read/Write DBF file In C# use IO/Stream (not OLEDB) Pin
CodingYoshi12-Dec-08 22:02
CodingYoshi12-Dec-08 22:02 
AnswerRe: How to Read/Write DBF file In C# use IO/Stream (not OLEDB) Pin
Mycroft Holmes12-Dec-08 23:08
professionalMycroft Holmes12-Dec-08 23:08 
QuestionHow to print richtextbox Pin
Laji5912-Dec-08 20:47
Laji5912-Dec-08 20:47 
AnswerRe: How to print richtextbox Pin
Lev Danielyan12-Dec-08 21:01
Lev Danielyan12-Dec-08 21:01 
GeneralRe: How to print richtextbox Pin
Laji5912-Dec-08 22:09
Laji5912-Dec-08 22:09 
GeneralRe: How to print richtextbox Pin
Lev Danielyan12-Dec-08 23:51
Lev Danielyan12-Dec-08 23:51 
GeneralRe: How to print richtextbox Pin
Dave Kreskowiak13-Dec-08 5:34
mveDave Kreskowiak13-Dec-08 5:34 

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.