如何使用另一个表单中的登录详细信息?

时间:2013-12-16 09:03:44

标签: vb.net forms project records

我正在创建一个Windows窗体应用程序,我已经进行了注册过程,因此用户数据被保存到记录中。我也得到了这样,当你去登录时,它会在我的记录中搜索输入的电子邮件并检查密码是否匹配。现在,在“签名页面”的下一个表单中,我希望在列表框中显示该页面上该记录的其他信息。有什么想法吗?

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSignIn.Click
    Dim RecordNumber As Integer
    Dim Found As Boolean
    Dim foundpword As Boolean
    Dim UserEmail As String
    Dim userPword As String
    Dim OneAccount As fmSignUp.SignUpInfo
    Dim stripeditem As String
    Dim strippword As String
    Dim CurrentUser As String

    UserEmail = tbEmailSignIn.Text
    userPword = tbPasswordSignIn.Text
    Found = False


    FileOpen(1, filename, OpenMode.Random, , , Len(OneAccount))
    Do While (Not EOF(1)) And (Found = False)


        RecordNumber = RecordNumber + 1
        FileGet(1, OneAccount, RecordNumber)
        stripeditem = OneAccount.ContactEmail.Replace(" ", "")
        strippword = OneAccount.Password.Replace(" ", "")




        If stripeditem = UserEmail Then
            Found = True

        End If
        If strippword = userPword Then
            foundpword = True
        End If




    Loop
    FileClose(1) 

这是我宣布记录的地方。

   Dim OneAccount As fmSignUp.SignUpInfo
    filename = "AccountDetails.dat"
    FileOpen(1, filename, OpenMode.Random, , , Len(OneAccount))
    NumberOfRecords = LOF(1) / Len(OneAccount)
    FileClose(1)

1 个答案:

答案 0 :(得分:0)

最简单的方法是在当前表单上创建一个公共方法 返回包含所有信息的变量或字符串列表 你需要一个表格, 那么你可以做其他形式:

Dim frm As Form1 = new Form1()
Dim tmp as string;
tmp = frm.ThatMethod()

请参阅以下内容: Using Variables Across Forms - VB