qadeer37
Well-known member
just starting to get into the habit of writing comments. What do think about my comment writing? any suggestions!
VB.NET:
Private Sub btnAddUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddUser.Click
Dim objUser As User
'Gets user index from UserList.
Dim UserIndex As Integer = lstUsers.FindStringExact(txtUserName.Text)
'Checks that all feilds are filled proper.
If txtUserName.Text = "" Or txtPassword.Text = "" Then
MessageBox.Show("Please fill all the feilds properly", "GameZone", MessageBoxButtons.OK, MessageBoxIcon.Error)
'Checks for whether UserName already exists.
ElseIf UserIndex >= 0 Then
MessageBox.Show("User already exists")
'add user object to the list.
Else
objUser = New User(txtUserName.Text, txtPassword.Text)
objUser.UserList.Add(objUser)
lstUsers.Items.Add(objUser)
End If
End Sub