1

I want to enable or disable the toolstripitems on the bindingnavigator programmatically.

When I try to set the toolStripitem's enable property, it does not change. It does not give any exception but the value of Enable property does not change.

What did I miss?

staticbeast
  • 2,073
  • 2
  • 22
  • 24
Ali Ersöz
  • 15,860
  • 11
  • 50
  • 64

1 Answers1

3

The BindingNavigator takes control of these buttons itself, to enable/disable them as appropriate; i.e. you can't go prev/next if there is no more data, you can't add/delete without the underlying source letting you (IBindingList.AllowNew/.AllowRemove.

Which buttons do you want to tweak? For example, you can disable add/remove by using a data-source such as BindingList<T>, and setting AllowNew=false/AllowRemove=false.

Alternatively, simply write your own buttons completely (forget BindingNavigator) - it isn't a lot of work, especially if you start with a BindingSource on the form (since that has all the necessary MoveFirst() etc.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900