Public Class TMyForm
Inherits Form
Protected ThisForm As Form
Protected IsOpened As Boolean
Protected Mode As FormMode
Enum FormMode
Gmail
Twitter
End Enum
Public Sub New(ByVal Form As Form)
Me.ThisForm = Form
End Sub
Public Sub SetUI(ByVal LoginTo As String)
If LoginTo Is Nothing Then
Me.IsOpened = False
Me.Close()
Else
Me.IsOpened = True
Select Case LoginTo
Case "Gmail"
Mode = FormMode.Gmail
Me.Text = "Gmail login"
Case "Twitter"
Mode = FormMode.Twitter
End Select
End If
End Sub
End Class
现在我想从我的主要表格中这样说:
Public Class SideBlock
Protected LoginForm As New LoginForm
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
SetLayout()
End Sub
Private Sub GmailToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GmailToolStripMenuItem.Click
Dim LoginForm As New TMyForm(Me.LoginForm)
LoginForm.SetUI("Gmail")
LoginForm.Show()
End Sub
End Class
正如您所看到的,我使用名为LoginForm的现有表单调用我的TMyForm类。点击Gmail按钮后,会出现登录表单,但是它的epmpty。应该有文本框等。但我看到的只是空格式。
我错过了什么吗?谢谢