The class style can be modified after window creation via the Windows API functions Get/SetClassLong (or Get/SetClassLongPtr for 64 bit compatibility).
Private Const GCL_STYLE As Integer = -26
Private Const CS_NOCLOSE As Integer = &H200
<DllImport("user32.dll", EntryPoint := "GetClassLong")> _
Private Shared Function GetClassLong(hWnd As IntPtr, nIndex As Integer) As UInteger
<DllImport("user32.dll", EntryPoint := "SetClassLong")> _
Private Shared Function SetClassLong(hWnd As IntPtr, nIndex As Integer, dwNewLong As UInteger) As UInteger
Private Sub ToggleStyleBtn_Click(sender As Object, e As EventArgs)
Dim currentStyle As UInteger = GetClassLong(Me.Handle, GCL_STYLE)
SetClassLong(Me.Handle, GCL_STYLE, currentStyle Xor CS_NOCLOSE)
UpdateStyles()
End Sub
Alan.