S
SagaV9
Guest
Hi all, I have an MDI app in Visual Studio 2015.
I am doing the classic search app's form to determine if a child form is already open. No problem with that; however, I need to check a property on that form to do further filtering, but I am defining a form of type Form in the search loop and the property is not being recognized. See code below.
How can I check the property's value when traversing the loop?
foreach (Form form in Application.OpenForms)
{
//Is it the form type that I am looking for?
if (form.GetType() == typeof(frmTransRep))
{
//Yes, check to see if it corresponds to the
//defined transaction.
if ((frmTransRep)form.TransId == Transactionid)
//Yup. just show.
form.Activate();
else
{ //Do something TBD
}
}
}
This is what I have so far. I tried (unsuccessfully) to cast the form object to the correct form type.
TransId is a public property in the frmTransRep form.
TransactionId holds a valid identifier for the transaction.
Thanks for your time and assistance! Saga
You can't take the sky from me
Continue reading...
I am doing the classic search app's form to determine if a child form is already open. No problem with that; however, I need to check a property on that form to do further filtering, but I am defining a form of type Form in the search loop and the property is not being recognized. See code below.
How can I check the property's value when traversing the loop?
foreach (Form form in Application.OpenForms)
{
//Is it the form type that I am looking for?
if (form.GetType() == typeof(frmTransRep))
{
//Yes, check to see if it corresponds to the
//defined transaction.
if ((frmTransRep)form.TransId == Transactionid)
//Yup. just show.
form.Activate();
else
{ //Do something TBD
}
}
}
This is what I have so far. I tried (unsuccessfully) to cast the form object to the correct form type.
TransId is a public property in the frmTransRep form.
TransactionId holds a valid identifier for the transaction.
Thanks for your time and assistance! Saga
You can't take the sky from me
Continue reading...