Wednesday, August 11, 2010

In Visual Basic when i add a record data grid is not refreshed. how to get a updated datagrid if you add?

While adding record in Visual Basic using add command button wherein datagrid is kept along with textbox when the user enters any data in the text box and click on add button the datagrid should refresh with added record and also when a record is deleted datagrid should be refreshed.In Visual Basic when i add a record data grid is not refreshed. how to get a updated datagrid if you add?
You'll have to ReBind the datagrid to the datatable or data source you are using. If you are using a database at the back, the better way to do it is to first place the newly inserted row in the datatable and refresh the datagrid with it:





'Bind the DataGrid to the DataTable.


dgContacts.DataSource = m_DataSet.Tables(';Addresses';)





Later you can save the new records to the database. This will give you more efficiency.In Visual Basic when i add a record data grid is not refreshed. how to get a updated datagrid if you add?
You got to recall the View method

No comments:

Post a Comment