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

📄 frmmain.vb

📁 一个用vb实现的网吧管理系统,是一个vb的课程设计.
💻 VB
字号:
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:2007/07/23
'描    述:网吧计费管理系统客户端/服务器端
'网    站:http://www.Mndsoft.com/  (VB6源码博客)
'网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
'e-mail  :Mndsoft@163.com
'e-mail  :Mndsoft@126.com
'OICQ    :88382850
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Public Class FrmMain
    Public Delegate Sub InvokeControl()
    Dim _InvokeControl As InvokeControl
    Private Sub FrmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ComboMessageType.SelectedIndex = 0
        NewComputer.FinalizeAllComputer()
        AddHandler NewServer.StatusChanged, AddressOf OnStutusChanged
        ShowComputer()
        _InvokeControl = AddressOf ShowComputer
        Dim T As New System.Threading.Thread(AddressOf NewServer.DoListen)
        T.Start()
    End Sub

    Sub ShowComputer()
        Dim ComputerTable As DataTable = ClsComputer.LoadComputer("", "")
        Dim ComputerRow As DataRow
        Dim litem As ListViewItem
        LvComputer.Items.Clear()
        For Each ComputerRow In ComputerTable.Rows
            If ComputerRow("Connected").ToString = "否" Then
                litem = New ListViewItem("计算机 " & ComputerRow("RoomNo").ToString & "-" & ComputerRow("PositionNo").ToString & "未连接", 1)
                LvComputer.Items.Add(litem)
            ElseIf ComputerRow("Connected").ToString = "是" And ComputerRow("UserName").ToString = "" Then
                litem = New ListViewItem("计算机 " & ComputerRow("RoomNo").ToString & "-" & ComputerRow("PositionNo").ToString & "已连接", 0)
                LvComputer.Items.Add(litem)
            ElseIf ComputerRow("Connected").ToString = "是" And ComputerRow("UserName").ToString <> "" Then
                Dim tempDBUser As New ClsUser
                tempDBUser.UserName = ComputerRow("UserName").ToString
                tempDBUser.GetInfo()
                litem = New ListViewItem(tempDBUser.RealName & "在使用计算机" & ComputerRow("RoomNo").ToString & "-" & ComputerRow("PositionNo").ToString, 0)
                LvComputer.Items.Add(litem)
            End If
        Next
    End Sub
    Public Sub OnStutusChanged()
        Me.LvComputer.Invoke(_InvokeControl)
    End Sub

    Private Sub ComboMessageType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboMessageType.SelectedIndexChanged
        If ComboMessageType.SelectedIndex = 1 Then
            Me.TxtMessage.Enabled = False
        Else
            Me.TxtMessage.Enabled = True
        End If
    End Sub

    Private Sub BtnBroadcast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBroadcast.Click
        Dim SendMessage As String
        If ComboMessageType.SelectedIndex = 0 Then
            If Trim(Me.TxtMessage.Text) = "" Then
                MessageBox.Show("广播的消息不能为空", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
                Exit Sub
            Else
                SendMessage = "BROADCAST," & Me.TxtMessage.Text
            End If
            SendMessage = "BROADCAST, "
        End If
        NewServer.Broad(SendMessage)
    End Sub


    Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmFeeList()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 添加用户ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加用户ToolStripMenuItem.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmAddUser()
        FrmObj.ShowDialog(Me)
    End Sub


    Private Sub 按用户类型ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按用户类型ToolStripMenuItem.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditUser_Group()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按用户类型ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按用户类型ToolStripMenuItem1.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelUser_Group()
        FrmObj.ShowDialog(Me)
    End Sub

   


    Private Sub 操作员登录ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 操作员登录ToolStripMenuItem.Click

        Dim FrmObj As New FrmLogin
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 添加操作员ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加操作员ToolStripMenuItem.Click
        If NewSuperUser.UserName <> "Admin" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmAddSuperUser
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 编辑操作员ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 编辑操作员ToolStripMenuItem.Click
        If NewSuperUser.UserName <> "Admin" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditSuperUser
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 删除操作员ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 删除操作员ToolStripMenuItem.Click
        If NewSuperUser.UserName <> "Admin" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelSuperUser
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
        If NewSuperUser.UserName <> "Admin" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmFeeRules
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 锁定屏幕ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 锁定屏幕ToolStripMenuItem.Click
        Me.Hide()
        Dim FrmObj As New FrmLockScreen
        FrmObj.ShowDialog(Me)
        Me.Show()
    End Sub


    Private Sub mnuAddFee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAddFee.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmAddFee()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub mnuAddComputer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAddComputer.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmAddComputer()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
        Dim FrmObj As New FrmModPwd()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按用户账号ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按用户账号ToolStripMenuItem.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditUser_UserName()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按用户姓名ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按用户姓名ToolStripMenuItem.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditUser_RealName()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按用户账号ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按用户账号ToolStripMenuItem1.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelUser_UserName()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按用户姓名ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按用户姓名ToolStripMenuItem1.Click
        If NewSuperUser.ModUser = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelUser_RealName()
        FrmObj.ShowDialog(Me)
    End Sub

    
   
    Private Sub 按机房编号ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按机房编号ToolStripMenuItem.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditComputer_RoomNo()
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按配置ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按配置ToolStripMenuItem.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditComputer_Config
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按计算机名称ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按计算机名称ToolStripMenuItem.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmEditComputer_ComputerName
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按机房编号ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按机房编号ToolStripMenuItem1.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelComputer_RoomNo
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按配置ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按配置ToolStripMenuItem1.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelComputer_Config
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub 按计算机名称ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 按计算机名称ToolStripMenuItem1.Click
        If NewSuperUser.ModComputer = "无权限" Then
            MsgBox("您无权访问此模块!", MsgBoxStyle.Exclamation, "信息框")
            Exit Sub
        End If
        Dim FrmObj As New FrmDelComputer_ComputerName
        FrmObj.ShowDialog(Me)
    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        添加用户ToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        ToolStripMenuItem5.PerformClick()
    End Sub

    Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
        添加操作员ToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
        mnuAddComputer.PerformClick()
    End Sub

    Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
        ToolStripMenuItem6.PerformClick()
    End Sub

    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
        锁定屏幕ToolStripMenuItem.PerformClick()
    End Sub

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

    Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click
        MsgBox("读者可以自行制作本系统的帮助文件!")
    End Sub
End Class

⌨️ 快捷键说明

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