更改子窗体标题(Visual Basic)

时间:2011-10-25 11:44:24

标签: vb.net forms window mdi

有人可以告诉我如何将MDI结构中子窗体的窗口标题更改为打开的文件名吗?

提前谢谢!

1 个答案:

答案 0 :(得分:1)

正如马可所说,这取决于你的具体情况。但是,这段代码(从here复制而来)在VB6和VB.Net中都显示了一个简单的例子:

' Visual Basic 6.0
Dim F(1 To 4) As New Form1
Private Sub MDIForm_Load()
   Dim i As Integer
   Load Form1
   For i = 1 To 4
      F(i).Caption = "Form" & i + 1
      F(i).Show
   Next I
End Sub



' Visual Basic 2005
Private Sub MDIForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Dim i As Integer = 0
  For i = 0 To 4
      Dim F As New FormChild
      F.Text = "Form " & CStr(i + 1)
      F.Show()
  Next
End Sub