Hey there.

I have a problem. But to make a Long story short, ill just say what i want to accomplish.

I have a Datagridview, I can re-arrainge the data inside of it, by clicking the column headers to "auto-Sort" my data. But now i insert another database into the datagridview, (After clearing it of course). But NOW when i want to use the auto-sort funcion it throws a "null Reference Exception". I can see that little arrow on the column header didnt disappear when i cleared the datatable and gridview.

I dont know of any Reset-datagridview-methods, so the only solution i can see is Disposing the Datagridview and re-opening it, but i dont know if that is possible.

Thank you =)

Recommended Answers

All 4 Replies

Yes, you can:

MydataGridView = null;
MyDataGridView = new DataGridView();

Hope this helps

commented: Gave the code, and it worked +1

Yes, you can:

MydataGridView = null;
MyDataGridView = new DataGridView();

Hope this helps

This worked indeed =)
Thank you lolafuertes =)

So, please, be so kind to mark this thread as solved.
Thanks in advance.

So, please, be so kind to mark this thread as solved.
Thanks in advance.

ahh sorry, i thought i did it?
=) Here you go.
And thanx again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.