Kliver Max
Kliver Max

Reputation: 5299

How to Clear BindingSource?

I have a DevExpress GridControl with BindingSouce. I want to clear a BindingSource and fill it with new data. I do:

var list = new List<MyClass>();
bindingSource.DataSource = list;

//**Do somthing with a data**//

bindingSource.DataSource = listOfMyClassObjects;

And after it i see a big red cross instead my GridControl.
How to clear BindingSource correctly?

Upvotes: 3

Views: 10416

Answers (1)

Aung Kaung Hein
Aung Kaung Hein

Reputation: 1566

In order to clear the BindingSource of GridControl, you can assign null to it's DataSource before you fill with new data.

bindingSource.DataSource = null;
bindingSource.DataSource = listOfMyClassObjects;

You might also refer to this StackOverflow question.

Upvotes: 6

Related Questions