I'm creating a windows form application and I have made the sign up process so the users data is saved to a record. I have also got it so that when you go to sign in it search my records for a e-mail that is typed in and checks if the password matches. Now on the next form of the 'Signed In Page' I want to display the other information from that record on the page probably in a listbox. Any ideas?
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)
This is where I declare the record.
Dim OneAccount As fmSignUp.SignUpInfo
filename = "AccountDetails.dat"
FileOpen(1, filename, OpenMode.Random, , , Len(OneAccount))
NumberOfRecords = LOF(1) / Len(OneAccount)
FileClose(1)
Simplest is to crate a public method on current form that returns a variable or a list of string that contains all information you require from one form, then in other form u can do:
Dim frm As Form1 = new Form1()
Dim tmp as string;
tmp = frm.ThatMethod()
See following as well: Using Variables Across Forms - VB