[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

Unstable designer when I include a ToolStripCheckbox Class

Hello.
I want to add a CheckBox to a toolstrip and havebeen able to do this with the class below. I added the line
<ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)> _

Open in new window

to have the CheckBox available in the designer, and this works. However, the designer is "unstable". I donot not know howelse to describe this, but, after adding the class below to the project, buttons already added to the project "at times" go missing from the designer or are in-accessible from the designer unless selected from the properties window. Infact, any further additions to the designer after compiling (and moving away from the designer then back) do not seem to "stick". Any ideas what is happening or on how toimplement this differently? I'd prefer to have the checkbox available in the designer. Here's is my entire class that is causing these issues.
Imports System.Windows.Forms.Design
<ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)> _
Public Class ToolStripCheckBox
    Inherits ToolStripControlHost
    Public Sub New()
        MyBase.New(New CheckBox)
    End Sub
    Public ReadOnly Property CheckBoxControl As CheckBox
        Get
            Return TryCast(Control, CheckBox)
        End Get
    End Property
    Public Property Checked As Boolean
        Get
            Return CheckBoxControl.Checked
        End Get
        Set(ByVal value As Boolean)
            CheckBoxControl.Checked = value
        End Set
    End Property
End Class

Open in new window

0
nepaluz
Asked:
nepaluz
  • 2
1 Solution
 
nepaluzAuthor Commented:
OK. I figured this one out. I was NOT putting the class in the form where I put the checkboxes. Putting the code under the form's class solved the issues I had.
0
 
nepaluzAuthor Commented:
I figured out the solution
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now