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

📄 studentteacherreceiveinfoform.vb

📁 管理毕业设计的管理系统 VB+SQL2000....
💻 VB
字号:
Public Class StudentTeacherReceiveInfoForm
    Private isDelete As Boolean = False

    Public Sub SetIsDelete()
        isDelete = True
    End Sub

    Private Sub StudentTeacherReceiveInfoForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListViewInfo.Items.Clear()

        Dim strSQL As String = "select * from information"
        Dim UserTable As DataTable = DBOperation.Search(strSQL)
        Dim UserRow As DataRow
        Dim LItem As ListViewItem
        Dim strDate As String
        Dim i As Integer = 0
        Dim n As Integer = 0

        For Each UserRow In UserTable.Rows
            i = i + 1
            LItem = New ListViewItem(i.ToString)
            LItem.SubItems.Add(UserRow("ititle"))
            LItem.SubItems.Add(UserRow("ename"))
            strDate = UserRow("idate")
            n = InStr(strDate, " ")
            LItem.SubItems.Add(strDate.Substring(0, n - 1))
            ListViewInfo.Items.Add(LItem)
        Next

        If isDelete Then
            ButtonDownload.Text = "删除"
            Me.Text = "删除通知"
        End If
    End Sub

    Private Sub ButtonDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDownload.Click
        Dim strTitle As String = ListViewInfo.SelectedItems(0).SubItems(1).Text
        Dim strSQL As String

        'Edu删除通知
        If isDelete Then
            Dim response As Integer = MsgBox("确定删除" + strTitle + "吗?", vbOKCancel + vbQuestion, "退出")
            If response = 2 Then
                Exit Sub
            End If

            strSQL = "delete information where ititle='" + strTitle + "'"
            If DBOperation.Delete(strSQL) Then
                MsgBox("删除成功!", MsgBoxStyle.OkOnly, "删除通知")
            Else
                MsgBox("删除失败!", MsgBoxStyle.Exclamation, "删除通知")
            End If
        Else 'Student、Teacher、Edu查看、下载通知
            If FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
                Dim filePath As String = FolderBrowserDialog1.SelectedPath
                My.Computer.FileSystem.CreateDirectory(filePath)

                strSQL = "select * from information where ititle='" + strTitle + "'"
                Dim UserTable As DataTable = DBOperation.Search(strSQL)
                Dim fileByte As Byte() = UserTable.Rows(0)("icontent")
                My.Computer.FileSystem.WriteAllBytes(filePath + "\" + strTitle + ".doc", fileByte, False)

                MsgBox("保存成功!", MsgBoxStyle.OkOnly, "下载通知")
            End If
        End If
    End Sub

    Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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