Hello:
Is there a function that will give me the name of the current form that is active?
Reason is that I am in a class that is called and I need to know the current focused form name.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipa AhujaPosted May 6, 2010, 3:00 AM
Dipa AhujaPosted May 6, 2010, 11:52 AM
GustavoPosted May 6, 2010, 10:52 AM
Thanks, it worked.
This is my code, just in case someone else might need to see an example:
string TheFormText;
string TheFormName;
string TheFormTag;
Form TheForm = Form.ActiveForm;
TheFormText = TheForm.ActiveMdiChild.Text.ToString();
TheFormName = TheForm.ActiveMdiChild.Name.ToString();
try
{
TheFormTag = TheForm.ActiveMdiChild.Tag.ToString();
}
catch
{
TheFormTag = "
}
I had to do a try/catch on the Tag, because if it does not have one, it blows up.
Thanks again
BTW: It would be a lot easier if I was trying to find the Form name is I was actually in the Form. But in my case, I am in a ClassControl that called the ClassValidate. So I am 2 levels away. I hope this helps others.
GustavoPosted May 5, 2010, 11:58 AM
I tried that but it gives me the MDIParent name not th child I am in. Can I change that so it will give me the child MDI?
Dipa AhujaPosted May 5, 2010, 11:54 AM