# Visual Basic > Visual Basic .NET > VS 2019 How to create an extended StatusStrip class?

## Mark@SF

I am trying to create custom StatusStrip class that has a few ToolStripStatusLabels.  So far, I've been able to create this class (StatusStripMain).  It compiles and appears in the VS Toolbox.  I can drag the StatusStripMain to a form's design surface and see the custom status strip, but its ToolStripStatusLabels are not individually selectable.



Double-clicking on the ModDate label via the form Designer opens the code editor for the StatusStripMain1.ItemClicked event (instead of the ToolStripStatusLabel.Click event):



```
Private Sub StatusStripMain1_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles StatusStripMain1.ItemClicked

    Debug.WriteLine(StatusStripMain1.Items.Count)
    For Each tsi As ToolStripItem In StatusStripMain1.Items
        Debug.WriteLine("{0} {1}", tsi.Name, tsi.Selected)
    Next

End Sub
```

The Debug.WriteLine results show the 4 ToolStripStatusLabel names and selected status (none of them are selected).

I can change the text of the labels at runtime using a cast.



```
CType(StatusStripMain1, ToolStrip).Items("tsslRecID").Text = "RecID:  1"
CType(StatusStripMain1, ToolStrip).Items("tsslAddDate").Text = "Added:  " & Date.Now.ToShortDateString
CType(StatusStripMain1, ToolStrip).Items("tsslModDate").Text = "Edited:  " & DateAdd(Interval:=DateInterval.Day, 5, Date.Now).ToShortDateString
CType(StatusStripMain1, ToolStrip).Items("tsslMessage").Text = "This is a custom message..."
```



If I use a "standard" StatusStrip and manually add the ToolStripStatusLabels via the form Designer, then at runtime I can change the label text directly (no cast).



```
tsslAddDate.Text = "Added: " & CDate(row.Item("AddDate")).ToString("d")
```

Here's my custom class code (cobbled up from a lot of Google searches  :Smilie: )...



```
Public Class StatusStripMain

    Inherits StatusStrip

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub InitializeComponent()

        Dim lbl As ToolStripStatusLabel

        Me.SuspendLayout()

        Me.Dock = DockStyle.Bottom
        Me.Name = "ssMain"
        Me.Text = "ssMain"

        lbl = New ToolStripStatusLabel
        With lbl
            .BorderSides = (System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            .Font = New System.Drawing.Font("Segoe UI", 8.0!)
            .Name = "tsslRecID"
            .Size = New System.Drawing.Size(54, 25)
            .Text = "RecID"
            .TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        End With
        Items.Add(lbl)

        lbl = New ToolStripStatusLabel
        With lbl
            .BorderSides = (System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            .Font = New System.Drawing.Font("Segoe UI", 8.0!)
            .Name = "tsslAddDate"
            .Size = New System.Drawing.Size(54, 25)
            .Text = "AddDate"
            .TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        End With
        Items.Add(lbl)

        lbl = New ToolStripStatusLabel
        With lbl
            .BorderSides = (System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            .Font = New System.Drawing.Font("Segoe UI", 8.0!)
            .Name = "tsslModDate"
            .Size = New System.Drawing.Size(54, 25)
            .Text = "ModDate"
            .TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        End With
        Items.Add(lbl)

        lbl = New ToolStripStatusLabel
        With lbl
            .BorderSides = (System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            .Font = New System.Drawing.Font("Segoe UI", 8.0!)
            .Name = "tsslMessage"
            .Size = New System.Drawing.Size(54, 25)
            .Text = "<Message>"
            .TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        End With
        Items.Add(lbl)

        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

End Class
```

Is this the right approach?  What else do I need to do to make the ToolStripStatusLabels work properly (like the "standard" StatusStrip labels)?

----------

