D
dgleeson3
Hello all
I have used the LoginForm1 class in a Visual studio 2005 VB
application.
Its the standard Username, Pasword request for user input.
I was hoping to use property procedures to get back the user input in
the two boxes but its not working out.
The key sections of code is below. When Im debugging this and break
in
the property procedure I just get Nothing for Username_property
and Username.
Im used to doing this in C++ and can see there is something missing
but dont know what that is.
-----------------------------------------------------------------------------
' First we put up Login form
' set the DialogResult for both buttons
If LoginForm_1.ShowDialog() <> DialogResult.OK Then
'close application
Environment.Exit(0)
' They did not want to log in so return to quit the
program
Return False
End If
-----------------------------------------------------------------------------
< THEN LATER in the same function I want to use the values from the
form as follows. >
If
(DataBase_Manager1.CheckPassword(LoginForm1.Username_property,
LoginForm1.Password_property)) Then
'User failed to log in, either let him/her try again
'or end the program. In this case I just end the program.
Return False
End If
----------------------------------------------------------------------------
< I even have a private variable called Username taking the value
from
the text box when OK is pressed>
Private Username As String
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
Username = UsernameTextBox.Text
End Sub
----------------------------------------------------------------------------
ReadOnly Property Username_property() As String
Get
' The Get property procedure is called when the value
' of a property is retrieved.
Return Username
End Get
End Property
-----------------------------------------------------------------------------
Many thanks for all input.
Regards
Denis
______________________
Denis Gleeson
http://www.CentronSolutions.com
I have used the LoginForm1 class in a Visual studio 2005 VB
application.
Its the standard Username, Pasword request for user input.
I was hoping to use property procedures to get back the user input in
the two boxes but its not working out.
The key sections of code is below. When Im debugging this and break
in
the property procedure I just get Nothing for Username_property
and Username.
Im used to doing this in C++ and can see there is something missing
but dont know what that is.
-----------------------------------------------------------------------------
' First we put up Login form
' set the DialogResult for both buttons
If LoginForm_1.ShowDialog() <> DialogResult.OK Then
'close application
Environment.Exit(0)
' They did not want to log in so return to quit the
program
Return False
End If
-----------------------------------------------------------------------------
< THEN LATER in the same function I want to use the values from the
form as follows. >
If
(DataBase_Manager1.CheckPassword(LoginForm1.Username_property,
LoginForm1.Password_property)) Then
'User failed to log in, either let him/her try again
'or end the program. In this case I just end the program.
Return False
End If
----------------------------------------------------------------------------
< I even have a private variable called Username taking the value
from
the text box when OK is pressed>
Private Username As String
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
Username = UsernameTextBox.Text
End Sub
----------------------------------------------------------------------------
ReadOnly Property Username_property() As String
Get
' The Get property procedure is called when the value
' of a property is retrieved.
Return Username
End Get
End Property
-----------------------------------------------------------------------------
Many thanks for all input.
Regards
Denis
______________________
Denis Gleeson
http://www.CentronSolutions.com