How to Bring to Front a usercontrol2 in a button click in usercontrol1 c#

时间:2017-12-18 05:14:36

标签: c# winforms user-controls

Firstly I had been searching about my problem and can't find. I have a Form1 and a usercontrol1 and usercontrol2, There is a button in Form1 when i click on a button the usercontrol1 will bring to front. In usercontrlol1 there is a button also when i click it the usercontrol2 will bring to front-but there is a problem usercontrol2 not appearing.

Here is my code;

private void button1_Click(object sender, EventArgs e)
{
    Form1 f1 = (this.Parent as Form1);
    f1.usercontrol2.BringToFront();
}

0 个答案:

没有答案