十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
'修改如下:
成都创新互联公司长期为成百上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为赤峰企业提供专业的成都做网站、成都网站制作,赤峰网站改版等技术服务。拥有10年丰富建站经验和众多成功案例,为您定制开发。
Public Sub Sort(a() As Integer)
Dim n As Integer, t As Integer
n = UBound(a())
For i = 1 To n - 1
For j = i + 1 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
增加一个模块
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
直接添加一个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