Reputation: 1277
I have populated a flowLayoutPanel with my custom control and subscribe to the MouseDown event of the controls. How do I create EventArgs to have assess to the custom control properties...
for(int i = 0; i < fileInfoArray.Length; i++)
{
myViewerArray[i] = new SubstanceViewer(fileInfoArray[i]);
myViewerArray[i].MouseDown += new MouseEventHandler(myViewerArray_MouseDown);
flowLayoutPanel1.Controls.Add(substanceViewerArray[i]);
}
so I can have access to my controls properties...
private void myViewerArray_MouseDown(object sender, MouseEventArgs e)
{
richTextBox1.Text = [myControl?].info
}
Upvotes: 0
Views: 42
Reputation: 63317
Access the sender
:
private void myViewerArray_MouseDown(object sender, MouseEventArgs e)
{
var myControl = sender as SubstanceViewer;
richTextBox1.Text = myControl.info;
}
Upvotes: 1