Archive for May, 2006

A BCL Method to Set a String in Title Case in C#

No need to create a function yourself or reference a VB library: A great post by Rick Strahl:

public static string TitleCase(string input)

{

      return System.Threading.Thread.CurrentThread.

             CurrentCulture.TextInfo.ToTitleCase(input);

}

Posted on:
Posted in .Net 2.0 | Comments Off on A BCL Method to Set a String in Title Case in C#

VSTO Action Pane Closing

When creating VSTO documents that use an Action Pane, the Action Pane gets “lost” if you open another non-VSTO document. The Action Pane is hidden by the different document (as it should), but when you switch back to the original VSTO document, the Action Pane does not automatically re-open itself. This can be fixed by handling the ThisWorkbook_WindowActivate event. In this event we can check the state of the Actions Pane and re-display it if necessary:

private void ThisWorkbook_WindowActivate(Microsoft.Office.Interop.Excel.Window Wn)
{
    if (!Globals.ThisWorkbook.ActionsPane.Visible)
    {
        Globals.ThisWorkbook.ActionsPane.Visible = true;
    }

    if (!ThisApplication.DisplayDocumentActionTaskPane)
    {
        ThisApplication.DisplayDocumentActionTaskPane = true;
    }
}

Posted on:
Posted in Office, VSTO | Comments Off on VSTO Action Pane Closing

Read and Learn

An awesome post by Jessica Fosler about finding memory leaks.

Posted on:
Posted in Performance | Comments Off on Read and Learn