Click here to Skip to main content
15,894,540 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: (untagged)
Hello there guys.. The language is c#...

This is what I am trying to do:

IF(form1 == active)
{
}

else
{
}

I dont know the code for it... in another words, I want the code to execute ONLY if the form is currently Active(Clicked on)

If it is NOT active, it will go to else.


Thanks guys !
Posted
Comments
Sergey Alexandrovich Kryukov 31-Jan-13 16:28pm    
No, nothing will work for you before you read some elementary manual on language, .NET and OOP and do simple exercises...
—SA

You need Form.ActiveForm[^] property.
 
Share this answer
 
You can use

if (Form.ActiveForm == this)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900