vb.net子窗体排序 vba简单窗体实例

vb.net中如何把所有MDI子窗体的标题栏文字设置为 “子窗体i” (i 表示子窗体序号)?增加一个模块
module mgrmdi
public mdifather as form=nothing
public mdison as integer=1
public sub OpenNewSon(byref SonForm as form)
___sonform.mdiparent=mdifather
___sonform.text=string.format("子窗体{0}",mdison.tostring)
___sonform.show
___mdison =1
end module
在mdi父窗体启动时
sub form_load()
mdifather=me
end sub
加载子窗体使用
sub button1_click()
dim newform as new formson
OpenNewSon(newform)
end sub
vb制作一个多窗体排序的功能'修改如下:
Public Sub Sort(a() As Integer)
Dim n As Integer, t As Integer
n = UBound(a())
For i = 1 To n - 1
For j = i1 To n
If a(i)a(j) Then
t = a(i): a(i) = a(j): a(j) = t
End If
Next j
Next i
End Sub
Private Sub Form_Load()
Me.Show
'这里应该还有对a数组赋值的代码
Call Sort(a())
Dim i As Integer
For i = 0 To UBound(a())
Picture1.Print a(i)
Next i
End Sub
怎么给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.Length1 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子窗体排序 vba简单窗体实例】vb.net子窗体排序的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vba简单窗体实例、vb.net子窗体排序的信息别忘了在本站进行查找喔 。

    推荐阅读