How do I close a form fired up by WindowsWorkspace

Topics: CAB & Smart Client Software Factory
Nov 12, 2005 at 2:24 PM
originally posted by: gamania

As far as we understand, WindowsWorkspace is used to fire up forms, dialogs. However, how do i close it programatically, except using the "X" on the form. Coz the controls in the form are actually stored in a view, which doesn't have workitem access. We used the injection in the view, but it's not injected the workspace that's actually showing the view. So we have to manually assign the workspace to the view in order to let the view be able to close the workspace.
Nov 15, 2005 at 6:29 AM
originally posted by: Darrenarbell

I had to create my own workspace derived from the WindowsWorkspace. With that I hooked up a FormClosed Event in my base usercontrol to that of the actual form that contained it.

public void Show(View smartPart, ISmartPartInfo smartPartInfo)
Form mdiChild = BuildForm(smartPart, smartPartInfo)
smartPart.FormClosed += new FormClosedEventHandler(FormClosed);

protected void FormClosed(object sender, FormClosedEventArgs e)

Hope that helps. I'm not sure if its the best approach, but it does appear(or rather dissappear - I'm so funny) to work.