Fly to the sky & Return

자식 form이 열려있는지 확인하는 코드 본문

프로그래밍/c# & VB 등

자식 form이 열려있는지 확인하는 코드

낼은어떻게 2023. 2. 3. 21:53
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
1
2
3
4
5
6
7
8
9
10
11
12
 private Form IsFormAlreadyOpen(Type FormType)
        {
            foreach (Form OpenForm in Application.OpenForms)
            {
                if (OpenForm.GetType() == FormType)
                    return OpenForm;
            }
 
            return null;
        }
 
 
cs

 

 

 

1
2
3
4
if ((IsFormAlreadyOpen(typeof(Form2)) != null))
{
   //코
}
cs