This tutorial is all about Register New User.
In this tutorial, I’m going to teach you how to register a new user in the User’s Registration Form. with this, you can add the users with there different types.
So let’s begin:
Open the file of “EmployeesInformationSystem” that you had created and go to the “ManageUserForm“. After that, double click the Form and add the following code for adding the items in the ComboBox, and setting up the “Password” TextBox.
- Private Sub ManageUserForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- 'MAKING THE TEXT INTO DOTS IN THE PASSWORD TEXTBOX
- txtPassword.UseSystemPasswordChar = True
- 'ADD ITEM IN THE COMBOBOX
- With cboType.Items
- End With
- End Sub
Go back to the Form Design and double click the “Save” Button to fire the
Click event handler of it. Set a insert query and call a method that you had created in saving the data in the MySQL Database.
- Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
- query = "insert into `useraccounts` (`USER_ID`, `UNAME`, `USERNAME`, `PASS`, `TYPE`)" & _
- "values ('" & txtUserId.Text & "','" & txtName.Text & "','" & txtUsername.Text & _
- "','" & txtPassword.Text & "','" & cboType.Text & "')"
- End Sub
Readers might read also: