I'm New in Programming, i can't identify some bugs/error if the Application doesn't tell me where's the error is. So the case is i Code Public Property in purpose to show Text (ID) from FormLogin TextBox into A Lable in another form (FormInputTimeSheet) to Retrieve some data from SQL Server by referring to the ID (i'm using word NIK for ID).
In FromLogin
Dim FIT As New FormInputTimeSheet
FIT.NIKLookup2 = FlTbNIK.Text
Me.Hide()
FormInputTimeSheet.Show()
MessageBox.Show("Login Success! Selamat Datang " & table.Rows(0)(1).ToString())
FlTbNIK is the TextBox i'm using to type ID for Login
In FormInputTimeSheet
Public Property NIKLookup2 As String
Private Sub FormInputTimeSheet_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FiLbNIK.Text = NIKLookup2
End Sub
FiLbNIK is the target Label and the result is Blank on the Label FiLbNIK
but in the same project i'm using same procedure but it worked, it is successed to show the ID from TextBox in FormLogin to Label in FormEditPassword, here is the code
In FormLogin
Dim FEP As New FormEditPassword
FEP.NIKLookup1 = FlTbNIK.Text
FEP.NameLookup = FlLbName.Text
Me.Hide()
FEP.Show()
In FormEditPassword
Public Property NIKLookup1 As String
Public Property NameLookup As String
Private Sub FormEditPassword_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FeLbEpHlp.Visible = False
FeLbNIK.Text = NIKLookup1
FeLbName.Text = NameLookup
End Sub
These Codes Worked and Showed the ID & Name.
Any Solution would be Appriciated. Thank before.
CodePudding user response:
As what Steve Had Answered from the comment, the error has been Solved by Changing
Dim FIT As New FormInputTimeSheet
FIT.NIKLookup2 = FlTbNIK.Text
Me.Hide()
***FormInputTimeSheet.Show()***
MessageBox.Show("Login Success! Selamat Datang " & table.Rows(0)(1).ToString())
To
Dim FIT As New FormInputTimeSheet
FIT.NIKLookup2 = FlTbNIK.Text
Me.Hide()
***FIT.Show()***
MessageBox.Show("Login Success! Selamat Datang " & table.Rows(0)(1).ToString())
Thanks Steve!