I have a ToolStripMenuItem
called myMenu
. How can I access this like so:
/* Normally, I would do: */
this.myMenu... etc.
/* But ho
One of the best way is a single row of code like this:
In this example we search all PictureBox
by name in a form
PictureBox[] picSample =
(PictureBox)this.Controls.Find(PIC_SAMPLE_NAME, true);
Most important is the second paramenter of find
.
if you are certain that the control name exists you can directly use it:
PictureBox picSample =
(PictureBox)this.Controls.Find(PIC_SAMPLE_NAME, true)[0];