i have created a form to add a new user but i need to make sure a user type is selected. This is done by selecting a radio button. How can i do this without the person having to write his/her desired username and password again? Also i am adding these into a text file, how would i encrypt this>
Thanks
ps I have added a screenshot showing what the form will look like
Public Class FormNewUser
Dim filename As String
Private Sub FormNewUser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click
Dim username As String
Dim password As String
Dim usertype As Short
Dim acceptable As Boolean
Do Until acceptable = True
acceptable = ok(usertype)
If acceptable = False Then
Me.Show()
Else
End If
Loop
username = txtnewuser.Text
password = txtnewpassword.Text
filename = "Users.txt"
FileOpen(1, filename, OpenMode.Append)
WriteLine(1, username, password, usertype)
End Sub
Function ok(ByVal usertype As Short)
Dim okay As Boolean
If rdobtnAdmin.Checked = True Then 'Checks to see a user type has been selected
usertype = 1
okay = True
ElseIf rdobtnUser.Checked = True Then
usertype = 2
okay = True
Else
MsgBox("You must select a user type!") 'Tells user to select a usertype
okay = False
End If
Return okay
End Function
End Class

New Topic/Question
Reply




MultiQuote




|