MDI子窗体:MdiChildrenForm1和一个非MDI窗体Form2
1. 先显示出MDI子窗体
MdiChildrenForm1.show()
2.单击MdiChildrenForm1上的按钮Button1,弹出Form2窗体;
3.当关闭Form2窗体时,如何将Form2窗体上产生的Label11值,传递给MdiChildrenForm1上的TextBox2控件值?
Form2窗体上的Button_Click事件:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Me.Label11.Visible = True Then
If Me.Label11.Text.Trim.ToString <> "" Then
'Dim hpfrm As MdiChildrenForm1= New MdiChildrenForm1()
'hpfrm.TextBox2.Text = Me.Label11.Text.Trim.ToString
MdiChildrenForm1.TextBox2.Text = Me.Label11.Text.Trim.ToString
End If
End If
Me.Dispose()
Me.Close()
End Sub
上面的执行结果得不到显示效果,请指教!
MDI子窗体传值 子窗体传值 MDI子窗体
------解决方案--------------------------------------------------------
http://www.cnblogs.com/cosoft/archive/2011/08/08/2130659
------解决方案--------------------------------------------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As New Form2
frm.pForm = Me
frm.Show()
End Sub
End Class
Public Class Form2
Public pForm As Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pForm.TextBox1.Text = Me.TextBox1.Text
End Sub
End Class