Click here to Skip to main content
15,798,592 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I want to refresh my datagrid automatically.
This means that when I add a user to my database, the grid shows that.

What can I do?

Please help me.

Thanks in Advance.
Updated 13-Jul-11 22:35pm
Dalek Dave 14-Jul-11 3:35am    
Edited for Spelling, Grammar and Readability.

If your app is not a web app, which it seems not to be, you can write C# code that runs inside a SQL trigger, and send a message to your app from there. The other option is, instead of listening on the DB, creating an event when a user is added by someone else. That is, assuming they can communicate to each other via the LAN or the web. You need to define your problem better to get a better answer.
Share this answer
[no name] 14-Jul-11 0:44am    
Good Call.+5.
I'm not sure if you really want to do this, but let me warn you that doing an autorefresh on your datagridview might cause performance issues, especially when you are dealing with large data and multiple users. But incase you really want to push through this, you can probably use a Timer Control[^]. Just set the interval(in milliseconds) and on the Timer.Tick event, put the code for refreshing the datagridview.
Share this answer
Use Timer Control with the interval, because it creates problem in the datagridview will create performance issues.
Share this answer
Christian Graus 14-Jul-11 0:48am    
That's not a solution, it's better to be told when to hit the DB. What if he has 500 users, all hitting the DB every 5 seconds ?
u would have done brought that gridview in a function...
bind that gridview again....
where u need that...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900