⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 empyroll.vb

📁 humar resourse management
💻 VB
📖 第 1 页 / 共 4 页
字号:




    End Sub
    Private Sub btnNavFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNavFirst.Click
        Me.BindingContext(objnewEmpDS, "tblEmployee").Position = 0
        Me.objnewEmpDS_PositionChanged()

    End Sub
    Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
        Me.BindingContext(objnewEmpDS, "tblEmployee").Position = (Me.objnewEmpDS.Tables("tblEmployee").Rows.Count - 1)
        Me.objnewEmpDS_PositionChanged()

    End Sub
    Private Sub btnNavPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNavPrev.Click
        Me.BindingContext(objnewEmpDS, "tblEmployee").Position = (Me.BindingContext(objnewEmpDS, "tblEmployee").Position - 1)
        Me.objnewEmpDS_PositionChanged()

    End Sub
    Private Sub btnNavNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNavNext.Click
        Me.BindingContext(objnewEmpDS, "tblEmployee").Position = (Me.BindingContext(objnewEmpDS, "tblEmployee").Position + 1)
        Me.objnewEmpDS_PositionChanged()

    End Sub
    Private Sub objnewEmpDS_PositionChanged()
        Me.lblNavLocation.Text = (((Me.BindingContext(objnewEmpDS, "tblEmployee").Position + 1).ToString + " of  ") _
                    + Me.BindingContext(objnewEmpDS, "tblEmployee").Count.ToString)

    End Sub
    Private Sub btnCancelAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancelAll.Click
        Me.objnewEmpDS.RejectChanges()

    End Sub
    Public Sub UpdateDataSet()
        'Create a new dataset to hold the changes that have been made to the main dataset.
        Dim objDataSetChanges As HRMS.newEmpDS = New HRMS.newEmpDS
        'Stop any current edits.
        Me.BindingContext(objnewEmpDS, "tblEmployee").EndCurrentEdit()
        'Get the changes that have been made to the main dataset.
        objDataSetChanges = CType(objnewEmpDS.GetChanges, HRMS.newEmpDS)
        'Check to see if any changes have been made.
        If (Not (objDataSetChanges) Is Nothing) Then
            Try
                'There are changes that need to be made, so attempt to update the datasource by
                'calling the update method and passing the dataset and any parameters.
                Me.UpdateDataSource(objDataSetChanges)
                objnewEmpDS.Merge(objDataSetChanges)
                objnewEmpDS.AcceptChanges()
            Catch eUpdate As System.Exception
                'Add your error handling code here.
                Throw eUpdate
            End Try
            'Add your code to check the returned dataset for any errors that may have been
            'pushed into the row object's error.
        End If

    End Sub
    Public Sub LoadDataSet()
        'Create a new dataset to hold the records returned from the call to FillDataSet.
        'A temporary dataset is used because filling the existing dataset would
        'require the databindings to be rebound.
        Dim objDataSetTemp As HRMS.newEmpDS
        objDataSetTemp = New HRMS.newEmpDS
        Try
            'Attempt to fill the temporary dataset.
            Me.FillDataSet(objDataSetTemp)
        Catch eFillDataSet As System.Exception
            'Add your error handling code here.
            Throw eFillDataSet
        End Try
        Try
            'Empty the old records from the dataset.
            objnewEmpDS.Clear()
            'Merge the records into the main dataset.
            objnewEmpDS.Merge(objDataSetTemp)
        Catch eLoadMerge As System.Exception
            'Add your error handling code here.
            Throw eLoadMerge
        End Try

    End Sub
    Public Sub UpdateDataSource(ByVal ChangedRows As HRMS.newEmpDS)
        Try
            'The data source only needs to be updated if there are changes pending.
            If (Not (ChangedRows) Is Nothing) Then
                'Open the connection.
                Me.OleDbConnection1.Open()
                'Attempt to update the data source.
                OleDbDataAdapter1.Update(ChangedRows)
            End If
        Catch updateException As System.Exception
            'Add your error handling code here.
            Throw updateException
        Finally
            'Close the connection whether or not the exception was thrown.
            Me.OleDbConnection1.Close()
        End Try

    End Sub
    Public Sub FillDataSet(ByVal dataSet As HRMS.newEmpDS)
        'Turn off constraint checking before the dataset is filled.
        'This allows the adapters to fill the dataset without concern
        'for dependencies between the tables.
        dataSet.EnforceConstraints = False
        Try
            'Open the connection.
            Me.OleDbConnection1.Open()
            'Attempt to fill the dataset through the OleDbDataAdapter1.
            Me.OleDbDataAdapter1.Fill(dataSet)
        Catch fillException As System.Exception
            'Add your error handling code here.
            Throw fillException
        Finally
            'Turn constraint checking back on.
            dataSet.EnforceConstraints = True
            'Close the connection whether or not the exception was thrown.
            Me.OleDbConnection1.Close()
        End Try

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub


    Private Sub emPyroll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        F1 = Me
        Try
            'Attempt to load the dataset.
            Me.LoadDataSet()
        Catch eLoad As System.Exception
            'Add your error handling code here.
            'Display error message, if any.
            System.Windows.Forms.MessageBox.Show(eLoad.Message)
        End Try
        Me.objnewEmpDS_PositionChanged()
    End Sub

    Private Sub cmd_Compute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Compute.Click
        'i try to call genPayr from module i created
        ' If F2 Is Nothing Then
        ' F2 = New genPayr
        ' F2.Show()
        ' End If


        'here I'll change it to load inside Parent Window
        Dim gen As New genPayr
        'gen.editemp_idno.Text = editemp_idno.Text
        'gen.editemp_fname.Text = editemp_fname.Text
        'gen.editemp_pos.Text = editemp_pos.Text
        'gen.editemp_stat.Text = editemp_stat.Text
        gen.Show()


        'here I changed it to load inside Parent Window
        'but didnt work the way i want it ie. cannot take the values 
        'to the nxt form (genPayr)

        'Dim ofrg As New genPayr
        'ofrg.MdiParent = ParentForm
        'ofrg.Show()


        'this will refresh the form (emPayroll)
        editemp_fname.Text = ""
        editemp_idno.Text = ""
        editemp_pos.Text = ""
        editemp_stat.Text = ""
        TextBox1.Text = ""

        'DataGrid1.Text = ""

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim dsTemp As New DataSet3 'Staff is your staff table
        'dsTemp is the temporary file for dataset2
        'all records in dataset2 is copied into dsTemp file for seach
        ' the purpose is to prevent the dataset2 from being disturbed/distorted
        Try
            If TextBox1.Text = "" Then
                MessageBox.Show("Search field is empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
            Else
                OleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM tblEmployee where emp_idno='" + TextBox1.Text + "'"
                'Adapter is the main core to Ms Access and VB connection to link the records(dataset) 
                'command (SQL) is written to search for record.
                'Adapter--> configure the connection-->and the command to view the records
                'that's the reason why OleDbDataAdapter is used througout
                OleDbDataAdapter1.Fill(dsTemp) 'Adapter is ready to fill the dsTemp file 
                DataSet31.Clear() 'This is reading each record from Dataset2 to find the record
                ' Once Dataset11 Merge the found record into dsTemp. 
                ' It clears the rest of the record from the list in order to the only record searched
                DataSet31.Merge(dsTemp) 'Once system has found the record it will copy 
                'the record from DataSet2 to DsTemp
            End If
        Catch ex As Exception

        End Try

        Try
            'Attempt to load the dataset.
            Me.LoadDataSet()
        Catch eLoad As System.Exception
            'Add your error handling code here.
            'Display error message, if any.
            System.Windows.Forms.MessageBox.Show(eLoad.Message)
        End Try
        Me.objnewEmpDS_PositionChanged()
    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()

    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -