如何刷新主窗体绑定的数据显示
绑定的access数据库:abc
主窗体:Form1
子窗体:Form2,对绑定的数据库abc执行添加、删除、修改、更新操作
退出子窗体时,如何写代码,可刷新主窗体的数据显示(显示操作后的数据)
[解决办法]
參考
[解决办法]
父窗体form1,用于弹出form2的button1这样写
private sub button1_click(by val .....)handles button1.click
dim frm2 as new form2()
if (frm2.showdialog() = dialogue.ok) then
bind_data
end if
子窗体form2,用于退出的button4这样写
me.dialogresult = windows.forms.dialogresult.ok
private sub refresh_data()
dim frm1 as new form1()
frm1.bind_data
end sub
然后在适当的地方调用这个refresh_data()
[解决办法]
你自己写的不对,这样写
主窗体
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click '弹出子窗体 Dim children As New FormChildren() children.Owner = Me children.ShowDialog() End Sub Public Sub Refresh(str As String) TextBox1.Text = str End Sub