OK, so I'm tentatively trying to get started with dotnet and am, as a means of learning the ropes, trying to port some of my old vlisp routines. I am getting the basics working (more or less) but there are some things that I'm not sure how to achieve so hope someone can help.
For this particular situation, I am trying to create a dialog box - a job for which I normally use ODCL. Again I have the basics working but some of it is currently very long-winded so want to try and trim it down a bit if possible.
On the dialog I have multiple pictureboxes and what I want to be able to do is press a button which will change the backcolor of all of them in one go. At this point in time I have simply got the same command many times over with just a different control name:
this.pictureBox1.BackColor = System.Drawing.Color.Green;
this.pictureBox2.BackColor = System.Drawing.Color.Green;
this.pictureBox3.BackColor = System.Drawing.Color.Green;
As you can appreciate, with many pictureboxes this makes for a lot of replication and I would ideally like to get away from that.
In my lisp/ODCL code I can create a loop which will allow me to modify multiple items as below:
(setq cnt 0)
(repeat 20
(dcl_Control_SetBackColor (eval (read (strcat " MyDialog_Ctrl" (itoa (setq cnt (1+ cnt)))))) 3 )
)
So what I would like to know is how to replicate this type of loop in C# so that I can do away with the plethora of replicated lines?