0

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??

4
Contributors
12
Replies
14
Views
6 Years
Discussion Span
Last Post by Jx_Man
0

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

0

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

0

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 .

0

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 by Jx_Man: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.