VB Express 2013 - 我自己的表单类是空的

时间:2015-05-29 21:56:47

标签: vb.net forms desktop-application

我正在创建桌面应用。我试着像这样创建自己的表单类:

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。应该有文本框等。但我看到的只是空格式。

我错过了什么吗?谢谢

0 个答案:

没有答案