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

C#

 
GeneralRe: C# files missing .cs file Pin
Member 906602518-Jul-12 0:47
Member 906602518-Jul-12 0:47 
GeneralRe: C# files missing .cs file Pin
Pete O'Hanlon18-Jul-12 1:30
mvePete O'Hanlon18-Jul-12 1:30 
GeneralRe: C# files missing .cs file Pin
Member 906602518-Jul-12 2:02
Member 906602518-Jul-12 2:02 
QuestionString to Object Instance Problem Pin
atoi_powered16-Jul-12 14:04
atoi_powered16-Jul-12 14:04 
AnswerRe: String to Object Instance Problem Pin
Wes Aday16-Jul-12 14:45
professionalWes Aday16-Jul-12 14:45 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 0:40
atoi_powered17-Jul-12 0:40 
AnswerRe: String to Object Instance Problem Pin
Pete O'Hanlon16-Jul-12 20:53
mvePete O'Hanlon16-Jul-12 20:53 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 0:25
atoi_powered17-Jul-12 0:25 
GeneralRe: String to Object Instance Problem Pin
Pete O'Hanlon17-Jul-12 1:16
mvePete O'Hanlon17-Jul-12 1:16 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 1:43
atoi_powered17-Jul-12 1:43 
GeneralRe: String to Object Instance Problem Pin
Pete O'Hanlon17-Jul-12 2:04
mvePete O'Hanlon17-Jul-12 2:04 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 3:42
atoi_powered17-Jul-12 3:42 
GeneralRe: String to Object Instance Problem Pin
Pete O'Hanlon17-Jul-12 3:50
mvePete O'Hanlon17-Jul-12 3:50 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 3:57
atoi_powered17-Jul-12 3:57 
GeneralRe: String to Object Instance Problem Pin
Pete O'Hanlon17-Jul-12 4:19
mvePete O'Hanlon17-Jul-12 4:19 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 4:21
atoi_powered17-Jul-12 4:21 
GeneralRe: String to Object Instance Problem Pin
Pete O'Hanlon17-Jul-12 4:25
mvePete O'Hanlon17-Jul-12 4:25 
GeneralRe: String to Object Instance Problem Pin
BobJanova17-Jul-12 3:58
BobJanova17-Jul-12 3:58 
GeneralRe: String to Object Instance Problem Pin
Pete O'Hanlon17-Jul-12 4:17
mvePete O'Hanlon17-Jul-12 4:17 
AnswerRe: String to Object Instance Problem Pin
BobJanova17-Jul-12 3:58
BobJanova17-Jul-12 3:58 
GeneralRe: String to Object Instance Problem Pin
atoi_powered17-Jul-12 4:09
atoi_powered17-Jul-12 4:09 
GeneralRe: String to Object Instance Problem Pin
BobJanova18-Jul-12 2:33
BobJanova18-Jul-12 2:33 
Define 'didn't work'.

Are all your picture boxes children of the same control? If so, you should use 'parentOfPBs.Controls' not 'this.Controls'. If not, you will have to traverse the whole control tree; I suggest you do this once and stash them in a list as it can be quite slow on a big form. You can use a standard recursive tree traversal similar to

public static List<T> GetControlsInTree<T>(Control parent) where T: Control {
 List<T> result = new List<T>
 AddControlsInTree(parent, result);
 return result;
}

static void AddControlsInTree<T>(Control parent, List<T> list) where T: Control {
 foreach (Control c in parent.Controls){
  T t = c as T;
  if (t != null) list.Add(t);
  AddControlsInTree(c, list);
 }
}


You can stash the list of picture boxes after form initialisation (after you call InitializeComponent in the constructor, for example):
List<PictureBox> pictures = GetControlsInTree<PictureBox>(this);


Then you can iterate over them at will:
private void ResetPictureBoxes()
 foreach(PictureBox picture in pictures)
  picture.BackgroundImage = Resource1.island;
}

GeneralRe: String to Object Instance Problem Pin
atoi_powered18-Jul-12 3:11
atoi_powered18-Jul-12 3:11 
QuestionBetter date / time parse? Pin
SledgeHammer0116-Jul-12 12:50
SledgeHammer0116-Jul-12 12:50 
AnswerRe: Better date / time parse? Pin
Peter_in_278016-Jul-12 14:01
professionalPeter_in_278016-Jul-12 14:01 

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.