Refreshing Datagridview C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • twigboy
    New Member
    • Mar 2007
    • 12

    Refreshing Datagridview C#

    Hi,
    I know this question has been asked many many times and I think I found the answer to this question to be to rebind the dataset. But my question is where do I do this. I have a main form that has a datagridview that displays data from an access database. I have three buttons to create a new entry edit and entry and close an entry. So where do I rebind the dataset after I have completed one of these tasks. I also have this set up as a strongly typed dataset if that helps.
    Thanks a bunch.
  • Teenzonez
    New Member
    • Mar 2007
    • 36

    #2
    Hi

    Create a method for doing databinding and call this method inside click event of each button

    Regards
    TeenzoneZ

    Comment

    • twigboy
      New Member
      • Mar 2007
      • 12

      #3
      So this is what I have for the databinding method
      Code:
      public void Refresh()
              {
                  unitTableDataGridView.DataSource = unitTableBindingSource;
              }
      I the call this in my edit button click event.
      my edit button click opens another form to edit the currently selected row.
      Even after I updated the database it still does not show in the datagridview. Am I missing something else?

      Comment

      • nmsreddi
        Contributor
        • Jul 2006
        • 366

        #4
        Hello

        There is no need of calling the databing in all button clicks ,but when ever you are updating your database (i.e entering new data at run time ) after saving data in database you can rebind your grid view thats all the updated data will be binded again to the grid view .

        Try it out ,it works fine

        Comment

        Working...