bavaro1

I have a BindingSource obtained by a DataReader.

How can I bind a ToolStripStatusLabel to my BindingSource

Can I make a Class with a Custom ToolStripStatusLabel



Re: Visual Basic Express Edition Databind to a ToolStripStatusLabel

Bruno Yu - MSFT

bavaro1,

In order to bind data to the ToolStripStatusLabel control, I recommand you to choose a data source for the StatusStrip control. In StatusStrip control, there is a property called DataBindings with three options: Advanced, Tag and Text. Just choose one of them and make a data source for the control. Please make sure that your SQL Express Edition and be accessed normally.

When you finish the data source for StatusStrip control, please take a look at the property Application Settings in ToolStripStatusLabel control. In PropertyBinding, you can set the name of your data source and then you will see the data source in the StatusStrip control. That is the BindingSource to this control.

You can also make a customer ToolStripStatusLabel control for your data binding. However, it needs more time and experience. Enjoy yourself with this method. :-)






Re: Visual Basic Express Edition Databind to a ToolStripStatusLabel

bavaro1

My ToolStripStatusLabel has to be binded dinamically with different BindingSource, so I need to do it on runtime. I'd need a few lines of code to do the job.

StatusStrip1.DataBindings.Add("Text", bsCustomers, "Customers_ID", True)

This works for the StatusStrip

How can I Make the StatusLabel show the "Customers_ID"





Re: Visual Basic Express Edition Databind to a ToolStripStatusLabel

Bruno Yu - MSFT

bavaro1,

Please try the code:

Dim text As bsCustomers

Dim instance As New ToolStripStatusLabel(text)

instance.Text=Customers_ID.ToString






Re: Visual Basic Express Edition Databind to a ToolStripStatusLabel

bavaro1

It doesn't work for me.

I solved in another way:

Private Sub bsCustomers_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bsCustomers.CurrentChanged

MyToolStripStatusLabel.Text = "ID: " & CStr(bsCustomers.Current.GetValue(0))

End Sub

Thanks anyway Bruno Yu