Refresh Data Grid View After Updating In Vb.net
i have a data grid view and details for a particular table.i update the details, But it doesn't get updated in the data grid view?my update statement works properly because, once i
Solution 1:
You have to re-bind it:
BindingSource binding = new BindingSource(); //req. by win forms
DataTable dt = new DataTable();
dt.Load(sql_command.ExecuteReader());
dgv.DataSource = dt;
This is the best way I've found to do it in win forms, .update doesn't work because it needs to actually re-pull the data from SQL.
Solution 2:
Just try to reuse your startup code in datagridview or recall the startup code from the data. It was the simple way at all. Cause your startup code is for binding your database to your datagridview. So, everytime you save, your code just save it and not work for rebind it again. So, what you need just try to rebind by recall the startup code
Post a Comment for "Refresh Data Grid View After Updating In Vb.net"