Click here to Skip to main content
15,896,269 members
Home / Discussions / C#
   

C#

 
GeneralRe: TCPIP server single connection Pin
ikurtz14-Jan-10 13:40
ikurtz14-Jan-10 13:40 
GeneralRe: TCPIP server single connection Pin
Luc Pattyn14-Jan-10 13:59
sitebuilderLuc Pattyn14-Jan-10 13:59 
QuestionMessage Removed Pin
14-Jan-10 10:13
KSR8114-Jan-10 10:13 
AnswerRe: Need help for these questions Pin
EliottA14-Jan-10 10:37
EliottA14-Jan-10 10:37 
GeneralRe: Need help for these questions Pin
OriginalGriff14-Jan-10 10:41
mveOriginalGriff14-Jan-10 10:41 
GeneralOR Pin
Ennis Ray Lynch, Jr.14-Jan-10 11:25
Ennis Ray Lynch, Jr.14-Jan-10 11:25 
AnswerRe: Need help for these questions Pin
Pete O'Hanlon14-Jan-10 10:51
mvePete O'Hanlon14-Jan-10 10:51 
QuestionDynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 10:00
professionalGuyThiebaut14-Jan-10 10:00 
I have a groupBox that has N PictureBox controls on it.
Each PictureBox is named thmb1-N e.g thmb26.

I have a list of paths, of thumbnail images, which I want to iterate through and set PictureBox control ImageLocation properties for each PictureBox .

The code I have written below is a first rather messy and quick attempt - which is cumbersome and I really don't want to be iterating through every object.

Is there a better way of doing this?

If I could do something like thmb + N.ImageLocation = ... but i realise I cannot do this in C# so any help in directing me towards how to do this would be much appreciated.

Guy


for (int i = 0; i < bubble.thumbs.Count; i++)
{
    foreach (Control ctrl in this.groupBox8.Controls)
    {
        if (ctrl is PictureBox)
        {
            if (LeftRightMid.Left(ctrl.Name.ToString(), 4) == "thmb"
                && Convert.ToInt32(LeftRightMid.Right(ctrl.Name.ToString(), 1)) == i)
            {
                ((PictureBox)(ctrl)).ImageLocation = bubble.thumbs[i];
            }
        }
    }
}



Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)


AnswerRe: Dynamically referencing a control - how do I do this (better)? Pin
OriginalGriff14-Jan-10 10:32
mveOriginalGriff14-Jan-10 10:32 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 10:42
professionalGuyThiebaut14-Jan-10 10:42 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
Eddy Vluggen14-Jan-10 11:58
professionalEddy Vluggen14-Jan-10 11:58 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 19:07
professionalGuyThiebaut14-Jan-10 19:07 
AnswerRe: Dynamically referencing a control - how do I do this (better)? Pin
Luc Pattyn14-Jan-10 13:12
sitebuilderLuc Pattyn14-Jan-10 13:12 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 19:05
professionalGuyThiebaut14-Jan-10 19:05 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
Luc Pattyn15-Jan-10 0:41
sitebuilderLuc Pattyn15-Jan-10 0:41 
Questionspeeech recognition project Pin
salman_kh14-Jan-10 8:14
salman_kh14-Jan-10 8:14 
AnswerRe: speeech recognition project Pin
Rick Shaub14-Jan-10 8:38
Rick Shaub14-Jan-10 8:38 
GeneralRe: speeech recognition project Pin
salman_kh14-Jan-10 8:54
salman_kh14-Jan-10 8:54 
GeneralRe: speeech recognition project Pin
Ennis Ray Lynch, Jr.14-Jan-10 9:18
Ennis Ray Lynch, Jr.14-Jan-10 9:18 
AnswerRe: speeech recognition project Pin
Saksida Bojan14-Jan-10 8:42
Saksida Bojan14-Jan-10 8:42 
AnswerRe: speeech recognition project Pin
dan!sh 14-Jan-10 8:45
professional dan!sh 14-Jan-10 8:45 
JokeRe: speeech recognition project Pin
Richard MacCutchan14-Jan-10 9:01
mveRichard MacCutchan14-Jan-10 9:01 
AnswerRe: speeech recognition project Pin
GuyThiebaut14-Jan-10 10:27
professionalGuyThiebaut14-Jan-10 10:27 
SuggestionRe: speeech recognition project Pin
Sreekanth12345678927-Jan-12 3:25
Sreekanth12345678927-Jan-12 3:25 
QuestionFoxPro To SQL Server Pin
427748014-Jan-10 5:21
427748014-Jan-10 5:21 

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.