Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Updating the DataGridView to Show New Rows From Other Forms
 

Updating the DataGridView to Show New Rows From Other Forms

I have a datagrid bound to a table through a DataSet that shows all of the rows in the table.

On the same form there's a button for adding a new row which opens a new dialog that walks the user through entering the proper information for a new item. The new item is added to the table via Linq to SQL when the user saves and exits the new dialog.

How do I get the DataGridView to refresh and show the new row? If I exit the application and restart it, the new row is displayed.

I'm guessing I have to call some method related to the bindings...?

Thanks.

J
http://digitalcamel.blogspot.com - .Net, ILM, SQL and Anything Else That Falls Out Of My Brain
Jerry Camel  Tuesday, August 04, 2009 4:13 PM
Got it... Just had to inspect some of the code that was being auto-generated...

Found the table adapter and a .Fill() call on that does the trick.
http://digitalcamel.blogspot.com - .Net, ILM, SQL and Anything Else That Falls Out Of My Brain
  • Marked As Answer byJerry Camel Tuesday, August 04, 2009 6:00 PM
  •  
Jerry Camel  Tuesday, August 04, 2009 6:00 PM

Tried this:

((BindingSource)gvProfiles.DataSource).ResetBindings(false);

But that doesn't help...

Jerry Camel  Tuesday, August 04, 2009 4:36 PM
Got it... Just had to inspect some of the code that was being auto-generated...

Found the table adapter and a .Fill() call on that does the trick.
http://digitalcamel.blogspot.com - .Net, ILM, SQL and Anything Else That Falls Out Of My Brain
  • Marked As Answer byJerry Camel Tuesday, August 04, 2009 6:00 PM
  •  
Jerry Camel  Tuesday, August 04, 2009 6:00 PM

You can use google to search for other answers

Custom Search

More Threads

• VB.net
• Drag and Drop Datasources have all stopped updating
• Help with DataGridView ComboBox NullValue
• DataGirdView: Vertical Scrollbar Problem
• How to remove the foremost column of DGV?
• HELP::::::::::::EDIT Functionality in DataGrid
• Adding image to DatagridViewCells
• How to Access SQLServer Express Database using ADODB?
• how to give color to background for MesseagBox
• Use a c# function in an DataGrid expression column?