Click here to Skip to main content
15,889,822 members
Home / Discussions / C#
   

C#

 
QuestionPlaying flv files [modified] Pin
Evgeni5713-May-09 18:26
Evgeni5713-May-09 18:26 
AnswerRe: Playing flv files Pin
Dave Kreskowiak13-May-09 19:16
mveDave Kreskowiak13-May-09 19:16 
GeneralRe: Playing flv files Pin
Evgeni5713-May-09 21:58
Evgeni5713-May-09 21:58 
Questionrestore database at an other server Pin
adsana13-May-09 17:57
adsana13-May-09 17:57 
AnswerRe: restore database at an other server Pin
Mycroft Holmes13-May-09 18:05
professionalMycroft Holmes13-May-09 18:05 
AnswerRe: restore database at an other server Pin
Rhys Jacob13-May-09 22:23
Rhys Jacob13-May-09 22:23 
QuestionHow to modify the foreach identifier? Pin
blackhattrick13-May-09 17:02
blackhattrick13-May-09 17:02 
AnswerRe: How to modify the foreach identifier? PinPopular
Luc Pattyn13-May-09 17:28
sitebuilderLuc Pattyn13-May-09 17:28 
Hi,

your code doesn't make much sense:

1.
the statement ctrl = tempPic; would do no good since tempPic already equals ctrl due to a previous assignment.

2.
why set a new value to ctrl, it is not used anywhere. (if you were to use PRE tags, see the "code block" button, you would have preserved the formatting of your code, making things much easier to read and understand).


BTW1: if(ctrl.GetType().ToString() == "System.Windows.Form.PictureBox")... is horrible; what you probably want is: if (ctrl is PictureBox)... or the "as" keyword (see below).

BTW2: your code will not compile, e.g. this.controls and ...Tag="1" are wrong

Maybe this is what you want overall:
foreach(Control ctrl in Controls) {
    PictureBox pb=ctrl as PictureBox;
    if(pb!=null && pb.Tag=="1") pb.Image=someImg;
}


I would like to suggest you buy a tutorial book on C# and study it; that will teach you all the basics in a structured and logical way, explaining the rationale and providing good examples.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

JokeRe: How to modify the foreach identifier? Pin
Samer Aburabie13-May-09 20:22
Samer Aburabie13-May-09 20:22 
QuestionDynamically adding a action to a datagrid Pin
Brad Wick13-May-09 13:29
Brad Wick13-May-09 13:29 
AnswerRe: Dynamically adding a action to a datagrid Pin
Mycroft Holmes13-May-09 14:30
professionalMycroft Holmes13-May-09 14:30 
AnswerRe: Dynamically adding a action to a datagrid Pin
Henry Minute13-May-09 14:38
Henry Minute13-May-09 14:38 
GeneralRe: Dynamically adding a action to a datagrid Pin
Mycroft Holmes13-May-09 18:07
professionalMycroft Holmes13-May-09 18:07 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute13-May-09 23:18
Henry Minute13-May-09 23:18 
GeneralRe: Dynamically adding a action to a datagrid Pin
Mycroft Holmes13-May-09 23:23
professionalMycroft Holmes13-May-09 23:23 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute14-May-09 0:04
Henry Minute14-May-09 0:04 
GeneralRe: Dynamically adding a action to a datagrid Pin
Brad Wick14-May-09 4:58
Brad Wick14-May-09 4:58 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute14-May-09 11:13
Henry Minute14-May-09 11:13 
GeneralRe: Dynamically adding a action to a datagrid Pin
Brad Wick14-May-09 13:00
Brad Wick14-May-09 13:00 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute14-May-09 13:13
Henry Minute14-May-09 13:13 
QuestionC# & Core 2 due CPUs Pin
Mohammad Dayyan13-May-09 12:30
Mohammad Dayyan13-May-09 12:30 
AnswerRe: C# & Core 2 due CPUs Pin
Luc Pattyn13-May-09 12:46
sitebuilderLuc Pattyn13-May-09 12:46 
AnswerRe: C# & Core 2 due CPUs Pin
Joe Woodbury13-May-09 15:38
professionalJoe Woodbury13-May-09 15:38 
Questionhow to add numbers to form with specified position Pin
Aljaz11113-May-09 12:27
Aljaz11113-May-09 12:27 
AnswerRe: how to add numbers to form with specified position Pin
Tony Richards13-May-09 12:43
Tony Richards13-May-09 12:43 

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.