Guys,
Do you know a way to check if a specific form is running? Just like similar to VS 6.0 Forms Collection.
The forms are not a MDI Child at all and this is Windows application only.
Thank you. Prefered coding in C# but VB.Net is ok also.
-vince
Printable View
Guys,
Do you know a way to check if a specific form is running? Just like similar to VS 6.0 Forms Collection.
The forms are not a MDI Child at all and this is Windows application only.
Thank you. Prefered coding in C# but VB.Net is ok also.
-vince
Why not try a message box or a log - jennifer
Try something likeCode:private void button1_Click(object sender, System.EventArgs e)
{
Form form2;
if(m_arrFormList.Count > 0)
{
form2 = (Form)m_arrFormList[0];
if(!form2.IsDisposed)
{
if(form2.WindowState == FormWindowState.Minimized)
form2.WindowState = FormWindowState.Normal;
form2.Activate();
return;
}
else
m_arrFormList.RemoveAt(0);
}
form2 = new Form2();
m_arrFormList.Add(form2);
form2.Show();
}
Array?... i was looking to a similar Forms property also like that w/c is
Form.OwnedForms Property but
I dont know if this is the best solution...
And if there is a Variable Object Collection w/c i will loop though it and see if a certain Form reference is running or not....
Well if you want your own forms collection you could make one, just add a form to it whenever you load it.
.Net has no equivalent to Forms Collection.
http://msdn.microsoft.com/library/de...alBasicNET.asp
:P
Yes, now refer back to my post #5 ... :)
I know and I read it already up to the
Walkthrough: Creating Your Own Collection Class
http://msdn.microsoft.com/library/de...ctionClass.asp
Just thinking w/c is better.
Your familiar with OwnedForms?
I dont know if this is a good one also.
Do you have C# 2005? If so you could use a generic List to contain your forms.
Code:using System.Windows.Forms;
using System.Collections.Generic;
// ....
public List<Form> Forms;
not installed yet.. but vs C# 2003, i had it here..
using System.Collections.Generic; <--- is this a lot better?
Planning to do the collection class w/c every time run a form i will just add it there and put something in the close event of the form to remove it.
anyways, thanks for the feed back guys!
Pre-2005 you needed to write your own Collection classes if you wanted to use strong binding, in VS 2005 you can use the classes in the Generic namespace. Generic-typed classes are strongly-bound at compile time to the type you specify. So it's equal to writing your own Forms collection class, without you having to do all the work :)