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

📄 admin.vb

📁 数据库学习的绝好例子简单的数据库经典入门
💻 VB
📖 第 1 页 / 共 5 页
字号:
        AddHandler imgUsers.MouseUp, AddressOf NavigationChildControl_MouseUp

        'Display a loading message
        ToolStripStatus.Text = "Loading..."

        'Set the current date in the date panel in the status bar
        ToolStripDate.Text = Date.Today

        'Get the applicataion title
        strAppTitle = My.Application.Info.Title

        'Show the form and refresh it
        Me.Show()
        Me.Refresh()

        'Load the projects
        LoadProjects()

        'Load the Groups
        LoadGroups()

        'Load the Roles
        Call LoadRoles()

        'Load the Users
        Call LoadUsers()

        'Load the Managers
        Call LoadManagers()

        'Display a ready message
        ToolStripStatus.Text = "Ready"
    End Sub
#End Region

#Region " Menu and Toolbar Procedures "
    Private Sub FileNew()
        'Clear the contents on the active screen
        Select Case strActiveScreen
            Case "Projects"
                txtProjectID.Text = String.Empty
                txtProjectName.Text = String.Empty
                txtProjectDescription.Text = String.Empty
                txtSequenceNumber.Text = String.Empty
                txtProjectUpdateDate.Text = String.Empty
            Case "Groups"
                txtGroupID.Text = String.Empty
                txtGroupName.Text = String.Empty
                txtGroupDescription.Text = String.Empty
                txtGroupUpdateDate.Text = String.Empty
            Case "Group Projects"
                cboGroups.SelectedIndex = -1
                lstGroupProjects.Items.Clear()
            Case "Roles"
                txtRoleID.Text = String.Empty
                txtRoleName.Text = String.Empty
                txtRoleDescription.Text = String.Empty
                txtRanking.Text = String.Empty
                txtRoleUpdateDate.Text = String.Empty
            Case "Users"
                txtUserID.Text = String.Empty
                optStatusActive.Checked = True
                txtLogin.Text = String.Empty
                txtPassword.Text = String.Empty
                txtFirstName.Text = String.Empty
                txtLastName.Text = String.Empty
                txtEmail.Text = String.Empty
                txtPhone.Text = String.Empty
                cboUserGroup.SelectedIndex = -1
                cboUserManager.SelectedIndex = -1
                cboUserRole.SelectedIndex = -1
                txtUserUpdateDate.Text = String.Empty
        End Select
    End Sub

    Private Sub EditUndo()
        'Process each control in the pnlScreens Panel
        For Each objPanel As Control In pnlScreens.Controls
            'If this is a Panel...
            If TypeOf objPanel Is Panel Then
                'Now process each control in all child 
                'Panels(e.g.pnlProjects, pnlGroups, pnlGroupProjects)
                For Each objPanelControl As Control In objPanel.Controls
                    'If this is a GroupBox...
                    If TypeOf objPanelControl Is GroupBox Then
                        'Process each control in the GroupBox
                        For Each objControl As Control In objPanelControl.Controls
                            'If this is a TextBox...
                            If TypeOf objControl Is TextBox Then
                                'If it has focus...
                                If objControl.Focused Then
                                    'Set a reference to it so the properties and 
                                    'methods are available
                                    Dim objTextBox As TextBox = objControl
                                    'See if last operation can be undone
                                    If objTextBox.CanUndo = True Then
                                        'Undo the last operation
                                        objTextBox.Undo()
                                    End If
                                    'The work is all done so exit the procedure
                                    Exit Sub
                                End If
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Private Sub EditCut()
        'Process each control in the pnlScreens Panel
        For Each objPanel As Control In pnlScreens.Controls
            'If this is a Panel...
            If TypeOf objPanel Is Panel Then
                'Now process each control in all child 
                'Panels(e.g.pnlProjects, pnlGroups, pnlGroupProjects)
                For Each objPanelControl As Control In objPanel.Controls
                    'If this is a GroupBox...
                    If TypeOf objPanelControl Is GroupBox Then
                        'Process each control in the GroupBox
                        For Each objControl As Control In objPanelControl.Controls
                            'If this is a TextBox...
                            If TypeOf objControl Is TextBox Then
                                'If it has focus...
                                If objControl.Focused Then
                                    'Set a reference to it so the properties and 
                                    'methods are available
                                    Dim objTextBox As TextBox = objControl
                                    'See if any text has been selected
                                    If objTextBox.SelectionLength > 0 Then
                                        'Cut the text and place it on the clipboard
                                        objTextBox.Cut()
                                    End If
                                    'The work is all done so exit the procedure
                                    Exit Sub
                                End If
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Private Sub EditCopy()
        'Process each control in the pnlScreens Panel
        For Each objPanel As Control In pnlScreens.Controls
            'If this is a Panel...
            If TypeOf objPanel Is Panel Then
                'Now process each control in all child 
                'Panels(e.g.pnlProjects, pnlGroups, pnlGroupProjects)
                For Each objPanelControl As Control In objPanel.Controls
                    'If this is a GroupBox...
                    If TypeOf objPanelControl Is GroupBox Then
                        'Process each control in the GroupBox
                        For Each objControl As Control In objPanelControl.Controls
                            'If this is a TextBox...
                            If TypeOf objControl Is TextBox Then
                                'If it has focus...
                                If objControl.Focused Then
                                    'Set a reference to it so the properties and 
                                    'methods are available
                                    Dim objTextBox As TextBox = objControl
                                    'See if any text has been selected
                                    If objTextBox.SelectionLength > 0 Then
                                        'Copy the text and place it on the 
                                        'Clipboard
                                        objTextBox.Copy()
                                    End If
                                    'The work is all done so exit the procedure
                                    Exit Sub
                                End If
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Private Sub EditPaste()
        'Process each control in the pnlScreens Panel
        For Each objPanel As Control In pnlScreens.Controls
            'If this is a Panel...
            If TypeOf objPanel Is Panel Then
                'Now process each control in all child 
                'Panels(e.g.pnlProjects, pnlGroups, pnlGroupProjects)
                For Each objPanelControl As Control In objPanel.Controls
                    'If this is a GroupBox...
                    If TypeOf objPanelControl Is GroupBox Then
                        'Process each control in the GroupBox
                        For Each objControl As Control In objPanelControl.Controls
                            'If this is a TextBox...
                            If TypeOf objControl Is TextBox Then
                                'If it has focus...
                                If objControl.Focused Then
                                    'Set a reference to it so the properties and 
                                    'methods are available
                                    Dim objTextBox As TextBox = objControl
                                    'See if there is any text on the Clipboard
                                    If Clipboard.GetDataObject().GetDataPresent( _
                                        DataFormats.Text) = _
                                        True Then
                                        'Paste the text from Clipboard
                                        objTextBox.Paste()
                                    End If
                                    'The work is all done so exit the procedure
                                    Exit Sub
                                End If
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Private Sub EditSelectAll()
        'Process each control in the pnlScreens Panel
        For Each objPanel As Control In pnlScreens.Controls
            'If this is a Panel...
            If TypeOf objPanel Is Panel Then
                'Now process each control in all child 
                'Panels(e.g.pnlProjects, pnlGroups, pnlGroupProjects)
                For Each objPanelControl As Control In objPanel.Controls
                    'If this is a GroupBox...
                    If TypeOf objPanelControl Is GroupBox Then
                        'Process each control in the GroupBox
                        For Each objControl As Control In objPanelControl.Controls
                            'If this is a TextBox...
                            If TypeOf objControl Is TextBox Then
                                'If it has focus...
                                If objControl.Focused Then
                                    'Set a reference to it so the properties and 
                                    'methods are available
                                    Dim objTextBox As TextBox = objControl
                                    'Select all available text
                                    objTextBox.SelectAll()
                                    'The work is all done so exit the procedure
                                    Exit Sub
                                End If
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Private Sub newToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles newToolStripMenuItem.Click

        FileNew()
    End Sub

    Private Sub exitToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles exitToolStripMenuItem.Click

        Me.Close()
    End Sub

    Private Sub undoToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles undoToolStripMenuItem.Click

        EditUndo()
    End Sub

    Private Sub cutToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles cutToolStripMenuItem.Click

        EditCut()
    End Sub

    Private Sub copyToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles copyToolStripMenuItem.Click

        EditCopy()
    End Sub

    Private Sub pasteToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles pasteToolStripMenuItem.Click

        EditPaste()
    End Sub

    Private Sub selectAllToolStripMenuItem_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles selectAllToolStripMenuItem.Click

        EditSelectAll()
    End Sub

⌨️ 快捷键说明

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