Home > Net >  ArgumentOutOfRangeException was unhandled - Index was out of range. Must be non-negative and less th
ArgumentOutOfRangeException was unhandled - Index was out of range. Must be non-negative and less th

Time:12-12

Here's the link for the error

Public Class frmMenu

Private Sub UserMaintenanceToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UserMaintenanceToolStripMenuItem.Click
    frmUser.Show()
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    Me.StatusStrip1.Items(0).Text = strUser
    Me.StatusStrip1.Items(1).Text = Today()
    Me.StatusStrip1.Items(2).Text = TimeOfDay()
End Sub

End Class

After I log in an existing user the error appears.

CodePudding user response:

The Items array of the StatusStrip1 element has no items. You need to make sure to fill it before you try to acces it.

  • Related