vb.net加form2 vb在form1里打开form2
vb.net 2010 中在form1中用动态数组的方法在form2生成了控件,如何在form2设置其单击事件?
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim pb As New PictureBox pb.Name = "pb" pb.Visible = True Form2.Controls.Add(pb) AddHandler pb.Click, AddressOf pbClick End Sub Private Sub pbClick(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(True) End Sub 简单的写了代码,希望对你有所帮助
创新互联公司专注于佛坪网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供佛坪营销型网站建设,佛坪网站制作、佛坪网页设计、佛坪网站官网定制、成都小程序开发服务,打造佛坪网络公司原创品牌,更为您提供佛坪网站排名全网营销落地服务。
vb.net中把窗体Form1的textbox值传给窗体Form2的textbox值,怎么实现?求大神指教
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a As New Form2(TextBox1.Text) '通过参数传递,同1
a.Show()
'form2.show()‘直接启动。同2
End Sub
End Class
Public Class Form2
Sub New(ByVal str As String)
' 此调用是设计器所必需的。
InitializeComponent()
' 在 InitializeComponent() 调用之后添加任何初始化。
TextBox1.Text = str '通过参数传递 1
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'直接在load事件中添加。此两法都可实现。2
' TextBox1.Text = Form1.TextBox1.Text
End Sub
End Class
'1和1一种方法,2和2是一种方法,可以删掉其中一种。
怎么给VB.NET窗体添加子窗体
直接添加一个MID父窗体或在已有窗体的属性中找到IsMDIContainer属性,然后设置为True,然后创建第二个窗体 ,需要加载子窗体的时候:
Dim NewMDIChild As New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
Public Shared Sub CheckMDIChildForm(ByVal MDIForm As Windows.Forms.Form, ByVal MDIChildForm As Windows.Forms.Form, ByVal MDIChildFormName As String)
If MDIForm.MdiChildren.Length 1 Then
'如果没有任何一个MDI子窗体,则创该MDI子窗体的窗体实例
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
Exit Sub
Else
Dim x As Integer
Dim frmyn As Boolean
For x = 0 To (MDIForm.MdiChildren.Length) - 1
Dim tempChild As Windows.Forms.Form = CType(MDIForm.MdiChildren(x), Windows.Forms.Form)
If tempChild.Name = MDIChildFormName Then
'检测到有该MDI子窗体,设为激活 并退出循环
frmyn = True
tempChild.BringToFront()
Exit For
Else
frmyn = False
End If
Next
If Not frmyn Then
'在打开的窗体中没检测到则新建
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
End If
End If
End Sub
vb.net 怎么样新建一个from2
打开Visual Studio,点击文件→新建项,选择“窗体”,在文件名那里输入Form2.vb就得了
网页名称:vb.net加form2 vb在form1里打开form2
URL地址:http://scyanting.com/article/hppphp.html