Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
I really hope anyone can help me with this. I am trying to retrieve the text from the StatusBarPanels by binding the text to a textbox, as suggested in How to get the TextChanged event of a StatusBarPanel[^]

Private StatusTextbox As TextBox
Private WithEvents oBinding As Binding

For Each pan As System.Windows.Forms.StatusBarPanel In SB.Panels
     oBinding = New Binding("Text", pan, "Text")
     AddHandler StatusTextbox.TextChanged, AddressOf StatusTextIsChanged
Next pan

The event never fires, what am I doing wrong?
Thank you in advance.
Updated 16-Mar-11 8:42am

1 solution

Are you trying to format the text before it's displayed? If so, you're going about it the wrong way. You need to handle the oBinding_Format event:

Private Sub oBinding_Format(ByVal sender As Object, ByVal e As System.Windows.Forms.ConvertEventArgs) Handles oBinding.Format
    e.Value = Format(e.Value, "MM/dd/yy")
End Sub
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900