Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# Questio. How to do this
Message
 
To
27/10/2005 14:25:30
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01062705
Message ID:
01062736
Views:
22
Perfect. I'll dive right into it.

Thanks!



>Kevin,
>
>I don't know if I answered your question when you posted previously, but here's what I *have* posted in the past, you need to have a FormsHandler class:
>
>First the FormsHandler class. Notice the static methods.
>
>using System;
>using System.Collections;
>using System.Windows.Forms;
>
>namespace MyNameSpace.MyClasses
>{
>	public class FormsHandler
>	{
>		#region Declarations
>		private static ArrayList list = new ArrayList();
>		#endregion
>
>		#region Methods
>		public static int Add(object o)
>		{
>			return list.Add(o);
>		}
>		public static void Remove(object o)
>		{
>			list.Remove(o);
>		}
>		public static bool Close()
>		{
>			int nCount = list.Count;
>			while (list.Count > 0)
>			{
>				((Form)list[0]).Close();
>				if (list.Count == nCount)
>					return false;
>				else
>					nCount = list.Count;
>			}
>
>			return true;
>		}
>		#endregion
>
>		#region Properties
>		public static ArrayList List
>		{
>			get {return list;}
>		}
>		#endregion
>	}
>}
>
>Whenever you open a form, no matter where you open it from, all you do is add it to the ArrayList, like this:
>
>Form oForm = new MyForm();
>FormsHandler.Add(oForm);
>oForm.Show();
>
>When you close your Main Form, you want all other's to Close (but to execute their own Closing methods) ... do it like this:
>
>// This is a menu item that exits the application
>
>private void menuItem4_Click(object sender, System.EventArgs e)
>{
>	System.ComponentModel.CancelEventArgs ee = new CancelEventArgs();
>	this.ClosingHandler(sender, ee);
>}
>
>// This is the ClosingHandler that will execute normally if you close the app
>// by clicking on the "X"
>
>private void ClosingHandler(object sender, System.ComponentModel.CancelEventArgs e)
>{
>	if (!FormsHandler.Close())
>		e.Cancel = true;
>	else
>		Application.Exit();
>}
>
>
>
>
>~~Bonnie
>
>
>
>>I asked this once before, but I'm still unsure.
>>
>>In VFP, I have a Window Manager class. You call
>>
>>
_Screen.oApp.oWindows.LaunchForm("SomeFormClass", p1, p2, ...)
>>
>>and internanlly, the class does a CREATEOBJECT("SomeFormClass") and stores the object reference to a
>>collection.
>>
>>Since the Windows class is attached to the Application class, which is attached to
>>_Screen, I can always get a reference to a form using the object hierarcy.
>>
>>What I'm trying to acheive is form control. I want to be able to get data from one
>>form or another, or close a form, or reposition forms (via Window Menu, Arrage bar)
>>and other similar functions.
>>
>>Basically, the window manager class controls, or keeps track of, all open windows in
>>the app.
>>
>>How would I do something like this in C#?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform