Click here to Skip to main content
15,883,999 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[^]

VB
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")
     StatusTextbox.DataBindings.Add(oBinding)
     AddHandler StatusTextbox.TextChanged, AddressOf StatusTextIsChanged
Next pan


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

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:

C#
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