VB.NET - Gridview in windows desktop application
Asked By Morne on 24-Dec-10 04:22 PM
Hi I am writing a Point of Sale software.
I am stuck can someone please help me with the following.
I have textboxes where you enter the information of a product that was bought e.g. Price, ect
Now I insert that into a database. How do I get a gridview to refresh without closing and reopening the form?
Please help
Thanks
bhaskar siddapuram replied to Morne on 24-Dec-10 09:11 PM
Hi,
First of all write the binding functionality of gridview in a separate method like
Protected void bindGridView()
{
DataTable dtTable = "GET Results into DataTable from DB"
GridView.DataSource =dtTable;
GridView.DataBind();
}
Now complete your update functionality in other method or button click event
protected void UpdateDB()
{
// after your update statement simply call the above method.
bindGridView();
}
That's it it will refresh the grid with new values.
Regards
Bhaskar
}