Martes, Enero 31, 2012

database

form1




Public Class Form1
    Private Sub enabledcontrol()
        Me.LastnameTextBox.Enabled = True
        Me.FirstnameTextBox.Enabled = True
        Me.MiTextBox.Enabled = True
        Me.SchoolyearTextBox.Enabled = True
        Me.CourseTextBox.Enabled = True
        Me.YearlevelTextBox.Enabled = True
        Me.SectionTextBox.Enabled = True
        Me.GenderTextBox.Enabled = True
        Me.CivilstatusTextBox.Enabled = True
        Me.NationalityTextBox.Enabled = True
        Me.BirthplaceTextBox.Enabled = True
        Me.BirthdateTextBox.Enabled = True
        Me.AgeTextBox.Enabled = True
        Me.GuardianTextBox.Enabled = True
        Me.AddressTextBox.Enabled = True
        Me.ContactnoTextBox.Enabled = True
        Me.EmailaddTextBox.Enabled = True
        Me.SchoolyearTextBox.Enabled = True
        Me.SemesterTextBox.Enabled = True

    End Sub
    Private Sub disabledcontrol()
        Me.LastnameTextBox.Enabled = False
        Me.FirstnameTextBox.Enabled = False
        Me.MiTextBox.Enabled = False
        Me.SchoolyearTextBox.Enabled = False
        Me.CourseTextBox.Enabled = False
        Me.YearlevelTextBox.Enabled = False
        Me.SectionTextBox.Enabled = False
        Me.GenderTextBox.Enabled = False
        Me.CivilstatusTextBox.Enabled = False
        Me.NationalityTextBox.Enabled = False
        Me.BirthplaceTextBox.Enabled = False
        Me.BirthdateTextBox.Enabled = False
        Me.AgeTextBox.Enabled = False
        Me.GuardianTextBox.Enabled = False
        Me.AddressTextBox.Enabled = False
        Me.ContactnoTextBox.Enabled = False
        Me.EmailaddTextBox.Enabled = False
        Me.SchoolyearTextBox.Enabled = False
        Me.SemesterTextBox.Enabled = False

    End Sub
    Private Sub InfoBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfoBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.InfoBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Student_profileDataSet)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Student_profileDataSet.info' table. You can move, or remove it, as needed.
        Me.InfoTableAdapter.Fill(Me.Student_profileDataSet.info)
        Me.disabledcontrol()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.InfoBindingSource.MoveNext()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.InfoBindingSource.MovePrevious()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If MsgBox("Add new record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Add") = MsgBoxResult.Yes Then
            Me.Student_profileDataSet.info.Clear()
            Me.InfoBindingSource.AddNew()
            Me.enabledcontrol()
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.enabledcontrol()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If MsgBox("Save current record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Save") = MsgBoxResult.Yes Then
            Me.InfoBindingSource.EndEdit()
            Me.InfoTableAdapter.Update(Me.Student_profileDataSet.info)
            Me.InfoTableAdapter.Fill(Me.Student_profileDataSet.info)
            Me.disabledcontrol()
        End If
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If MsgBox("Cancel current record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Cancel") = MsgBoxResult.Yes Then
            Me.InfoBindingSource.RemoveCurrent()

            Me.InfoTableAdapter.Update(Me.Student_profileDataSet.info)
            Me.InfoTableAdapter.Fill(Me.Student_profileDataSet.info)
            Me.disabledcontrol()
        End If
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If MsgBox("Delete current record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete") = MsgBoxResult.Yes Then
            Me.InfoBindingSource.CancelEdit()
            Me.Student_profileDataSet.info.Clear()
            Me.disabledcontrol()
        End If
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Close()

    End Sub

    Private Sub AddressTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddressTextBox.TextChanged

    End Sub
End Class
form2

Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim orow As DataRow
        For Each orow In Me.Student_profileDataSet1.UserInfo
            If (orow.Item("Username") = Me.TextBox2.Text) And (orow.Item("Password") = Me.TextBox1.Text) Then
                MsgBox("Access Granted")
                Form3.form_access = True
            End If
        Next
        If Form3.form_access = True Then
            Me.Close()
        Else
            MsgBox("access denied!incorrect username/password")

        End If


     
    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Student_profileDataSet1.UserInfo' table. You can move, or remove it, as needed.
        Me.UserInfoTableAdapter.Fill(Me.Student_profileDataSet1.UserInfo)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()

    End Sub
End Class

form3


Public Class Form3
    Public form_access As Boolean
    Public Class form3

    End Class
    Private Sub CSL2AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CSL2AToolStripMenuItem.Click
        Form1.ShowDialog()
    End Sub

    Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.Click

    End Sub

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Form2.ShowDialog()

    End Sub

 
    Private Sub UserAccuntSittingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserAccuntSittingToolStripMenuItem.Click
        Form4.ShowDialog()

    End Sub

    Private Sub RestorFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RestorFileToolStripMenuItem.Click
        Form7.ShowDialog()
    End Sub

    Private Sub BackUpFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackUpFileToolStripMenuItem.Click
        Form6.ShowDialog()
    End Sub

    Private Sub StudentFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StudentFileToolStripMenuItem.Click

    End Sub
End Class
form4

Public Class Form4

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Me.TextBox1.Text = "ruben" Then
            MsgBox("access granted")
            Me.Close()
            Form5.ShowDialog()
        Else
            MsgBox("access denied incorrect username/password")
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()

    End Sub

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

form5

Public Class Form5

    Private Sub enabledcontrol()
        Me.TextBox1.Enabled = True
        Me.TextBox2.Enabled = True

    End Sub
    Private Sub disabledcontrol()
        Me.TextBox1.Enabled = False
        Me.TextBox2.Enabled = False

    End Sub
    Private Sub UserInfoBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserInfoBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.UserInfoBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Student_profileDataSet2)

    End Sub

    Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Student_profileDataSet2.UserInfo' table. You can move, or remove it, as needed.
        Me.UserInfoTableAdapter.Fill(Me.Student_profileDataSet2.UserInfo)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNEXT2.Click
        Me.UserInfoBindingSource.MovePrevious()

    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPREVIOUS2.Click
        Me.UserInfoBindingSource.MoveFirst()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSAVE2.Click
        If MsgBox("Save current record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Save") = MsgBoxResult.Yes Then
            Me.UserInfoBindingSource.EndEdit()
            Me.UserInfoTableAdapter.Update(Me.Student_profileDataSet2.UserInfo)
            Me.UserInfoTableAdapter.Fill(Me.Student_profileDataSet2.UserInfo)
            Me.disabledcontrol()
            Me.btnEDIT2.Visible = False
            Me.btnSAVE2.Visible = True
            Me.btnCANCEL2.Visible = True
            Me.BTNADD2.Visible = True

        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEDIT2.Click
        Me.enabledcontrol()

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNADD2.Click
        If MsgBox("Add new record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Add") = MsgBoxResult.Yes Then
            Me.Student_profileDataSet2.UserInfo.Clear()
            Me.UserInfoBindingSource.AddNew()
            Me.enabledcontrol()

        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDELETE2.Click

        Me.btnCANCEL2.Visible = True
        Me.BTNADD2.Visible = True
        If MsgBox("Delete current record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete") = MsgBoxResult.Yes Then
            Me.UserInfoBindingSource.CancelEdit()
            Me.Student_profileDataSet2.UserInfo.Clear()
            Me.disabledcontrol()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCLOSE.Click
        Me.Close()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCANCEL2.Click
        If MsgBox("Cancel current record, are you sure?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Cancel") = MsgBoxResult.Yes Then
            Me.UserInfoBindingSource.RemoveCurrent()

            Me.UserInfoTableAdapter.Update(Me.Student_profileDataSet2.UserInfo)
            Me.UserInfoTableAdapter.Fill(Me.Student_profileDataSet2.UserInfo)
            Me.disabledcontrol()
        End If
    End Sub
End Class

form6

Public Class Form6

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If MsgBox("back up database files?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "BACK UP") = MsgBoxResult.Yes Then
            My.Computer.FileSystem.CopyFile("student profile.mdb", Me.ComboBox1.Text & "BACK UP.mdb")
        End If
    End Sub

    Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        For i = 3 To 26
            Me.ComboBox1.Items.Add(Chr(64 + i) & ":/")

        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()

    End Sub
End Class

form7

Public Class Form7

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If MsgBox("Restore database Back Up ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Restore") = MsgBoxResult.Yes Then
            If My.Computer.FileSystem.FileExists("Me.ComboBox1.Text & Restore.mdb") Then
                My.Computer.FileSystem.CopyFile("me.combobox1.text & restore.mdb", "student profile.mdb")
            End If

        End If
    End Sub

    Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim x As Integer
        For x = 3 To 26
            Me.ComboBox1.Items.Add(Chr(64 + x) & ":/")

        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()

    End Sub
End Class

Walang komento:

Mag-post ng isang Komento