Home > Net >  Datagridview refresh problems, urgent, urgent
Datagridview refresh problems, urgent, urgent

Time:02-27


Click on the enter button by fom1 frm2
Frm2 input data after success in the access database to add a record
Rebind frm1 datagridview data sources of
GetAdap (" the date of the select d.I D, d. y. license plate number, k. name as a boss, d. field, d. unloading field, d. category, d. weight, d. rate, d. freight, y. oil amount, y. oil, y. fuel, y., add water, y. urea, y. tolls, y. repair, y. fines, y. other, d. note from orders as D, transportation as y, where customers as k d.I D=y. The order ID And d. customer ID=k.I D ", "the new subsidiary")
FrmCheYunShu. DataGridView1. The DataSource=Nothing
FrmCheYunShu. DataGridView1. The DataSource=objDset. Tables (" the new subsidiary ")
But the datagridview frm1 don't refresh, must fom1 load again to see the newly added record

CodePudding user response:

Frm2 declare an event directly, after adding the data to perform the event, frm1 Load event binding Load method

CodePudding user response:

reference 1st floor qq_37254374 response:
frm2 declare an event directly, after adding the data to perform the event, frm1 Load event binding Load method

Can you give a specific point code?

CodePudding user response:

Public Class frm2
Public Shared Event OnRefresh ()//declare an Event
After the input method of click add
RaiseEvent OnRefresh ()//perform this event

The End of the Class

Public Class frm1
Private Sub frm_PatrolGroup_Load (sender As Object, As EventArgs e) Handles MyBase. Load
AddHandler frm_PatrolGroup_add OnRefresh, AddressOf Me.
LoadData//bind loading methodEnd Sub
Private Sub frm_PatrolGroup_FormClosing (sender As Object, e As FormClosingEventArgs) Handles MyBase. FormClosing
RemoveHandler frm_PatrolGroup_add OnRefresh, AddressOf Me. LoadData//closing remove event
End Sub
The End of the Class

CodePudding user response:

The corresponding form name it ourselves

CodePudding user response:

reference 4 floor qq_37254374 response:
corresponding form name it ourselves

The add. OnRefresh can't how to write this sentence