Thanks
I am building a desktop application.
Log in form in visual basic 2019.
I want to create a login form in access database program which allows each user to create his username and password and resetting password via forgot password link.
3 answers
Sort by: Most helpful
-
Sheelnath Kekre 121 Reputation points
2021-02-04T02:30:11.157+00:00 -
Albert Kallal 5,331 Reputation points
2021-02-04T15:55:45.907+00:00 Ok, so this is desktop. Well then you simply have to build a form. Say like this:
And the code behind the logon button would be this:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim strSQL As String = "SELECT * from tblUsers Where User = @user AND Password = @Pass" Dim MyTable As New DataTable Using cmdSQL As New OleDbCommand(strSQL, New OleDbConnection(My.Settings.TestDB)) cmdSQL.Parameters.Add("@User", OleDbType.VarWChar).Value = txtUser.Text cmdSQL.Parameters.Add("@Pass", OleDbType.VarWChar).Value = txtPass.Text cmdSQL.Connection.Open() MyTable.Load(cmdSQL.ExecuteScalar) If MyTable.Rows.Count <> 0 Then ' code here - logon was ok Else ' code here - logon was NOT ok End If End Using End Sub
So, how your logon form is going to look and in fact work? Well there are more ways to do this then there are flavors of ice cream.
So, you build a form, and it is assumed that you have a table of "users" in the database with things like user name, email, and of course the password and logon name to be used.
So the above in code would take the values from the two text boxes on the form, and check/test/grab if the row (and user) exists in the database table called tblUsers.
From then on? Well, any much more you choose to do in code and with your forms is up to you. You are starting out with a blank canvas to paint on so to speak - so you can quite much build anything you want, but you have to do the work! The system will not create nor build you the forms, nor write your code and what you want to achieve here. But the sky is the limit here.
Regards,
Albert D. Kallal (Access MVP 2003-2017)
Edmonton, Alberta Canada -
Sheelnath Kekre 121 Reputation points
2021-02-05T12:55:46.88+00:00 Ok Done. Thankyou.