Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Refreshing DataGrid automatically

Posted on 2009-04-29
Medium Priority
Last Modified: 2013-12-17
Good morning,

I would like to update my DataGrid but I do not know the "best way" to do that if there is one.

At the moment, I'm using an ObservableCollection to know when a new data is added to my Collection and then use the event "CollectionChanged" to update manualy my DataGrid.

Is there another way to do that without using an ObservableCollection ? Binding ?

Thank you
Question by:smuhr
  • 2
  • 2
LVL 83

Accepted Solution

CodeCruiser earned 375 total points
ID: 24290146
DataTable. Use a DataTable as the datasource to the datagridview.

Author Comment

ID: 24312054
Why is it better ?

I would like to understand because I've never used it :)

Thank you,
LVL 83

Expert Comment

ID: 24312142
Its better bacause its meant for this type of scenario. Any changes made in the datagrid when a datatable is the datasource would be automatically reflected to the datatable and you can then save these changes to database as well.

Author Comment

ID: 24312159
Ok, thank you :)


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question