Hi,
I'm currently using a dataentry connected to a bindingnavigator. I'm using the below code to check when the bindingsource collection change.
The goal is to disable the delete button in the bindingnavitor when the bindingsource collection has 1 item in it like shown below:
bs.ListChanged += (s, e) =>
{
int itemCount = Convert.ToInt32(bindingNavigator.BindingNavigatorElement.PageLabel.Text.Split(' ')[1]);
if (itemCount == 1)
{
bindingNavigator.BindingNavigatorElement.DeleteButton.Enabled = false;
}
else
{
bindingNavigator.BindingNavigatorElement.DeleteButton.Enabled = true;
}
};
However, I'm having a hard time disable the delete button. As seen in the ListChanged, I'm using below code to disable the button, but it seems that it has no effect at all. Am I doing something wrong?
bindingNavigator.BindingNavigatorElement.DeleteButton.Enabled = false;