« Great library of stock business images | Main | Setting the unsettable settings »

December 27, 2005

DesignMode not working

In the development of a control, I was having a problem when checking to see if the control was running at design time, or run time. You're supposed to be able to check the DesignMode property of the Control base class to know, but this wasn't always working.

Instead, I gen'd up the following class to do the DesignMode check:

Public Class VSHost
    Public Shared Function DesignMode() As Boolean
        If AppDomain.CurrentDomain.DomainManager IsNot Nothing Then
            Return AppDomain.CurrentDomain.DomainManager.ToString. _
                Contains("Microsoft.VisualStudio.CommonIDE")
        Else
            Return False
        End If
    End Function

End Class

Posted on December 27, 2005 at 02:40 PM | Permalink

Comments

The comments to this entry are closed.