i hve 2 form..first for insert dat & second for preview data..i'm using datagrid to preview data from accessdatabase..

how to make datagrid automaticly load data form database after insert new data..data grid only load after i relaunch my application...do i need create refresh button or anything else??

timer keeps executing even if you do not insert new record, so consumes system resources un-necessarily.

Me.TableNameTableAdapter.Fill(Me.databasenameDataSet.Tablename)

If you using dataset from vb try this one, It`s load the database to your datagrid
put in on your refresh button

how to make datagrid automaticly load data form database after insert new data..data grid only load after i relaunch my application...do i need create refresh button or anything else??

I suggest to make a function to preview data. so you can call it anywhere. after insert, edit or delete data or refresh button .

You said that you only can preview data on data grid when you load your form.
So the code that you using to preview data at load form, make it like procedure/function.
You just call the function to refresh datagrid from anywhere.
After insert, edit or delete data or on refresh button.

Just put your preview code into procedure/function

Public Sub RefreshDataGrid()
   ... 'Your query to preview data on datagrid
End Sub

You can call that procedure at any event to refresh data grid

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
    ... 'your code to insert data
    RefreshDataGrid ' call refreshdatagrid function to refresh data on datagrid after insert statment
End Sub

Do the same thing for edit or delete event or refresh button.

Edited 5 Years Ago by Jx_Man: n/a

This question has already been answered. Start a new discussion instead.