0% found this document useful (0 votes)
17 views3 pages

Form 1 3

Uploaded by

lawrencepogi122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Form 1 3

Uploaded by

lawrencepogi122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

FORM 1

Imports MySql.Data.MySqlClient
Public Class Form1
Dim connection As New
MySqlConnection("datasource=localhost;port=3306;username=root;password=;database=2ndQUIZJP")
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim command As New MySqlCommand("Select `EMAIL`, `PASSWORD` FROM
`FAKEBOOK`WHERE`EMAIL` =@username AND `PASSWORD` = @password", connection)

command.Parameters.Add("@username", MySqlDbType.VarChar).Value = TextBox1.Text


command.Parameters.Add("@password", MySqlDbType.VarChar).Value = TextBox2.Text

Dim adapter As New MySqlDataAdapter(Command)


Dim table As New DataTable()

adapter.Fill(table)

If table.Rows.Count = 0 Then

MessageBox.Show("Invalid Username or Password")

Else

MessageBox.Show("Logged In")
Form3.Show()
Me.Hide()

End If
End Sub

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged

If TextBox2.UseSystemPasswordChar = True Then

TextBox2.UseSystemPasswordChar = False

Else

TextBox2.UseSystemPasswordChar = True
End If

End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles


LinkLabel1.LinkClicked
Form2.Show()
Me.Hide()
End Sub
End Class

FORM 2
Imports MySql.Data.MySqlClient
Public Class Form2

Dim connection As New


MySqlConnection("datasource=localhost;port=3306;username=root;password=;database=2ndQUIZJP")
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim command As New MySqlCommand("INSERT INTO `fakebook`(`ID`, `EMAIL`, `PASSWORD`,`FIRST


NAME`,`MIDDLE INITIAL`,`LAST NAME`)
VALUES (@id1,@eml1,@pw1,@fn1,@mi1,@ln1)", connection)

command.Parameters.Add("@id1", MySqlDbType.Int64).Value = TextBox1.Text


command.Parameters.Add("@eml1", MySqlDbType.VarChar).Value = TextBox2.Text
command.Parameters.Add("@pw1", MySqlDbType.VarChar).Value = TextBox3.Text
command.Parameters.Add("@fn1", MySqlDbType.VarChar).Value = TextBox4.Text
command.Parameters.Add("@mi1", MySqlDbType.VarChar).Value = TextBox5.Text
command.Parameters.Add("@ln1", MySqlDbType.VarChar).Value = TextBox6.Text

connection.Open()

If command.ExecuteNonQuery() = 1 Then

MessageBox.Show("Data Inserted")

Else

MessageBox.Show("ERROR")
End If

connection.Close()
Form1.Show()
Me.Close()
End Sub

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged


If TextBox3.UseSystemPasswordChar = True Then

TextBox3.UseSystemPasswordChar = False

Else
TextBox3.UseSystemPasswordChar = True
End If
End Sub
End Class

FORM 3
Public Class Form3
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Form1.Show()
Me.Close()

End Sub
End Class

You might also like