How to close the current SmartPart in a CAB application

I have this SCSF (CAB) application in which I want to close the current tab (TabbedWorkspace) programmatically when the user closes it. So I took these steps:
 
1. In the Shellform add a context menu with one element: "Close"
2. Then add a menu handler :

private void closeToolStripMenuItem1_Click(object sender, EventArgs e)

{

    object obj = _leftWorkspace.ActiveSmartPart;

    _leftWorkspace.Close(obj);

}

Now users can close any smartpart by right clicking the tab page and selecting Close. It is easy to add other functionality to the context menu now, like "Close All but This".

About Gaston

MCT, MCSD, MCDBA, MCSE, MS Specialist
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s