refresh datagridview automatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • YouPoP
    New Member
    • Jun 2007
    • 17

    #1

    refresh datagridview automatically

    Hi,

    I have a Window Form to which i added a datagridview. The binding source is working well, but does not update if the database is modified outside the application (i mean not showing the modification made to the database).

    Trying to solve my problem, i added a timer to the form that Fill the datagridview every xx milliseconds (basically a timer that calls the Form_Load method). The timer is working nicely, but because it always refresh the grid i can not "work" with the grid, can not add or delete any row because the refresh is too fast. If i change the timer delay for longer delay, i do not see the "real time" changes made outside the program.

    What i would like to do is Fill (or anything else) the datagridview only when the data in the database is changed, so i could work in the datagridview of my form and also refresh it when changes have been made from outside the program.

    I'm using VS 2005 Framework 2.0 and my program is C#.

    Thanks in advance for your help
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Maybe have your timer check for changes first and then if there are changes refresh. Alternately stop the timer while in edit mode and then start again after editing. HTH.
    Originally posted by YouPoP
    Hi,

    I have a Window Form to which i added a datagridview. The binding source is working well, but does not update if the database is modified outside the application (i mean not showing the modification made to the database).

    Trying to solve my problem, i added a timer to the form that Fill the datagridview every xx milliseconds (basically a timer that calls the Form_Load method). The timer is working nicely, but because it always refresh the grid i can not "work" with the grid, can not add or delete any row because the refresh is too fast. If i change the timer delay for longer delay, i do not see the "real time" changes made outside the program.

    What i would like to do is Fill (or anything else) the datagridview only when the data in the database is changed, so i could work in the datagridview of my form and also refresh it when changes have been made from outside the program.

    I'm using VS 2005 Framework 2.0 and my program is C#.

    Thanks in advance for your help

    Comment

    • YouPoP
      New Member
      • Jun 2007
      • 17

      #3
      do you have any exemple of code you could provide me or link me to please... it looks like I actually am the main bug (hehe)

      thanks

      Comment

      Working...