Home > DeveloperSection > Forums > Get form name which form control are triggered in C#?
ben reitman
ben reitman

Total Post:96

Posted on    March-06-2013 4:44 AM

 C# C# 

 1 Reply(s)
 2803  View(s)
Rate this:

 Hi Expert!

I am creating a log file for stored generated exception, so I have needed to get which form control are fire. Please help me for getting name of current windows form are open.

Thanks in advance! 


Total Post:604

Posted on    March-06-2013 7:52 AM

Hi Ben!

There are two way!

If you want to used as globle then try this way

string sFormName = this.FindForm().Name;

Another way is, if you get form name at same page then used this way, but above code are used both places

string SFormName = this.ActiveControl.FindForm().Name.ToString();

Don't want to miss updates? Please click the below button!

Follow MindStick