jamesrhaynes
Programmer
I can determine which panel of a status bar was clicked by the index with the following code.
Private Sub StatusBar1_PanelClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.StatusBarPanelClickEventArgs) Handles StatusBar1.PanelClick
Dim stbPanel As StatusBarPanel
Dim intIndex As Integer
Try
stbPanel = e.StatusBarPanel
intIndex = StatusBar1.Panels.IndexOf(stbPanel)
Select Case intIndex
Case 0
Case 1
Case 2
End Select
Catch ex As Exception
'
End Try
End Sub
This is not reliable as the order can be changed quite easily. Other collections (e.g. toolbar) allow the retrieval of the item name or even provide a tag that can be used to identify. The status bar seems to have no means of identifying which panel was clicked. I could retrieve the panel text but that isn't a constant.
The command stbPanel.tostring gives just a generic string for any status bar panel with no indication of which panel it was. Isn't that strange!
My panels all have "Names" in design mode, how can I determine which Name was clicked so that the current order of layout is unimportant??
Private Sub StatusBar1_PanelClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.StatusBarPanelClickEventArgs) Handles StatusBar1.PanelClick
Dim stbPanel As StatusBarPanel
Dim intIndex As Integer
Try
stbPanel = e.StatusBarPanel
intIndex = StatusBar1.Panels.IndexOf(stbPanel)
Select Case intIndex
Case 0
Case 1
Case 2
End Select
Catch ex As Exception
'
End Try
End Sub
This is not reliable as the order can be changed quite easily. Other collections (e.g. toolbar) allow the retrieval of the item name or even provide a tag that can be used to identify. The status bar seems to have no means of identifying which panel was clicked. I could retrieve the panel text but that isn't a constant.
The command stbPanel.tostring gives just a generic string for any status bar panel with no indication of which panel it was. Isn't that strange!
My panels all have "Names" in design mode, how can I determine which Name was clicked so that the current order of layout is unimportant??