Login form:
Login form is a way by which you can easily identify the users of an application. there are various steps to create the login form, that are:
Step first, to Design the window forms:
Step second, to Design the Data Base:
Step third, establish connection B/w application and database Imports System.Data.OleDbModule Module1 Public constringAs OleDbConnection =New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=D:\My_db11.accdb")End Module
Step four, write Sign in code: Imports System.Data.OleDbImports System.Windows.Forms Public Class Form1 Dim Str As String Dim Ds As DataSet Dim Da As OleDbDataAdapter Private Sub Button2_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs)Handles Button2.Click Dim Signup As New Signup Signup.Show() End Sub Private Sub Button1_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs)Handles Button1.Click constring.Open() Str = "Select Fname,Password from info2 where Fname='" & TextBox1.Text &"' and Password ='" & TextBox2.Text &"';" Dim com As New OleDbCommand(Str, constring) Dim rd As OleDbDataReader = com.ExecuteReader() If rd.Read() =True Then MessageBox.Show("Valid username and password") Else MessageBox.Show("Invalid username and password") End If End SubEnd Class
Step five, write Signup code: Imports System.Data.OleDb Public Class Signup Dim Da As OleDbDataAdapter Dim dS As DataSet Dim SqlString As String Private Sub Button1_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs)Handles Button1.Click constring.Open() SqlString = "insert into info2 values(" SqlString += """" & TextBox1.Text & """" SqlString += "," SqlString += """" & TextBox2.Text & """" SqlString += "," SqlString += """" & ComboBox1.Text & """" SqlString += "," SqlString += """" & TextBox3.Text & """" SqlString += ")" Dim DaAs New OleDbDataAdapter If (TextBox3.Text = TextBox4.Text)Then Da.InsertCommand = New OleDbCommand(SqlString, constring) Da.InsertCommand.ExecuteNonQuery() MessageBox.Show("record inserted successfully") Else MessageBox.Show("re enter password") End If End SubEnd Class
Output:
How to create the login form in VB.NET
Transfer Data from and to MS-Access, SQL Server, and XML Data Sources
Super tutorial...easy to understand...like a mother teach to the child...
great tutorial sir,, ahm sir can you also make tutorial for making a login history,, which records the user who loged in and if he modify the program like if he edit delete etc on the system then it will besaved on the database?
keep it
very nice and helpful article