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

📄 history.vb

📁 windows mobile下的一个东西
💻 VB
字号:
Public Class History
    Dim db_cmd As New System.Data.SqlServerCe.SqlCeCommand
    Dim db_adp As System.Data.SqlServerCe.SqlCeDataAdapter
    Dim DT_daily As System.Data.DataTable = New System.Data.DataTable("Daily")
    Dim DT_row As System.Data.DataRow

    Dim D_ID As Integer

    Public Sub New()

        ' 此调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        ' 在 InitializeComponent() 调用之后添加任何初始化。

    End Sub

    Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        Dim P, C As Integer
        If TreeView1.SelectedNode.Parent Is Nothing Then
            D_ID = -1
        Else
            P = TreeView1.SelectedNode.Parent.Tag
            If P = 0 Then
                C = TreeView1.SelectedNode.Tag
                db_cmd.CommandText = "select M_ID from Daily where R_time IS NOT NULL ORDER BY R_time DESC"
                db_cmd.Connection = db_c
                db_adp = New System.Data.SqlServerCe.SqlCeDataAdapter(db_cmd)
                DT_daily.Clear()
                db_adp.Fill(DT_daily)
                Select Case C
                    Case 0
                        D_ID = DT_daily.Rows(0)("M_ID")
                    Case 1
                        D_ID = DT_daily.Rows(1)("M_ID")
                    Case 2
                        D_ID = DT_daily.Rows(2)("M_ID")
                    Case 3
                        D_ID = DT_daily.Rows(3)("M_ID")
                    Case 4
                        D_ID = DT_daily.Rows(4)("M_ID")
                    Case Else
                        C = -1
                End Select
            ElseIf P = 1 Then
                C = TreeView1.SelectedNode.Tag
                db_cmd.CommandText = "select M_ID from Daily ORDER BY M_ID DESC"
                db_cmd.Connection = db_c
                db_adp = New System.Data.SqlServerCe.SqlCeDataAdapter(db_cmd)
                DT_daily.Clear()
                db_adp.Fill(DT_daily)
                Select Case C
                    Case 0
                        D_ID = DT_daily.Rows(0)("M_ID")
                    Case 1
                        D_ID = DT_daily.Rows(1)("M_ID")
                    Case 2
                        D_ID = DT_daily.Rows(2)("M_ID")
                    Case 3
                        D_ID = DT_daily.Rows(3)("M_ID")
                    Case 4
                        D_ID = DT_daily.Rows(4)("M_ID")
                    Case Else
                        C = -1
                End Select
            End If
        End If
        
    End Sub

    Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
        TreeView1.ExpandAll()
    End Sub

    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        TreeView1.CollapseAll()
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        Form2.Show()
        Me.Hide()
    End Sub

    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
        TreeView1.CollapseAll()
    End Sub

    Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
        TreeView1.ExpandAll()
    End Sub



    Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem8.Click
        If D_ID <> -1 Then
            db_cmd.CommandText = "select * from Daily where M_ID = ' " & D_ID & " '"
            db_cmd.Connection = db_c
            db_adp = New System.Data.SqlServerCe.SqlCeDataAdapter(db_cmd)
            DT_daily.Clear()
            db_adp.Fill(DT_daily)

            See.TextBox1.Text = DT_daily.Rows(0)("W_year").ToString + "-" + DT_daily.Rows(0)("W_month").ToString + "-" + DT_daily.Rows(0)("W_day").ToString
            See.TextBox2.Text = DT_daily.Rows(0)("Weather").ToString
            See.DBrowsew.Text = DT_daily.Rows(0)("M_daily").ToString
            See.TextBox3.Text = DT_daily.Rows(0)("M_mood").ToString
            See.TextBox4.Text = WhichWeek(DT_daily.Rows(0)("W_year"), DT_daily.Rows(0)("W_month"), DT_daily.Rows(0)("W_day"))
            See.Show()

        Else
            MsgBox("请选择子结点")
        End If

    End Sub

    Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
        If D_ID <> -1 Then
            db_cmd.CommandText = "select * from Daily where M_ID = ' " & D_ID & " '"
            db_cmd.Connection = db_c
            db_adp = New System.Data.SqlServerCe.SqlCeDataAdapter(db_cmd)
            DT_daily.Clear()
            db_adp.Fill(DT_daily)

            See.TextBox1.Text = DT_daily.Rows(0)("W_year").ToString + "-" + DT_daily.Rows(0)("W_month").ToString + "-" + DT_daily.Rows(0)("W_day").ToString
            See.TextBox2.Text = DT_daily.Rows(0)("Weather").ToString
            See.DBrowsew.Text = DT_daily.Rows(0)("M_daily").ToString
            See.TextBox3.Text = DT_daily.Rows(0)("M_mood").ToString
            See.TextBox4.Text = WhichWeek(DT_daily.Rows(0)("W_year"), DT_daily.Rows(0)("W_month"), DT_daily.Rows(0)("W_day"))
            See.Show()
        Else
            MsgBox("请选择子结点")
        End If
    End Sub

    Private Sub MenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem9.Click
        If D_ID <> -1 Then
            db_cmd.CommandText = "select * from Daily where (M_ID = ' " & D_ID & " ')"
            db_cmd.Connection = db_c
            db_adp = New System.Data.SqlServerCe.SqlCeDataAdapter(db_cmd)
            DT_daily.Clear()
            db_adp.Fill(DT_daily)
            rewrite.year = DT_daily.Rows(0)("W_year").ToString
            rewrite.month = DT_daily.Rows(0)("W_month").ToString
            rewrite.day = DT_daily.Rows(0)("W_day").ToString
            rewrite.weather = DT_daily.Rows(0)("Weather").ToString
            rewrite.D_ID = D_ID
            rewrite.YearBox.Text = rewrite.year.ToString
            rewrite.MonthBox.Text = rewrite.month.ToString
            rewrite.DayBox.Text = rewrite.day.ToString
            rewrite.Weather1.Text = rewrite.weather.ToString
            rewrite.TextBox1.Text = DT_daily.Rows(0)("M_daily").ToString
            rewrite.moodBox.Text = DT_daily.Rows(0)("M_mood").ToString
            rewrite.TextBox2.Text = WhichWeek(DT_daily.Rows(0)("W_year"), DT_daily.Rows(0)("W_month"), DT_daily.Rows(0)("W_day"))
            rewrite.Button1.Enabled = True
            rewrite.Button2.Enabled = True
            rewrite.Show()

        Else
            MsgBox("请选择子结点")
        End If
    End Sub

    Private Sub MenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem10.Click
        If D_ID <> -1 Then
            db_cmd.CommandText = "select * from Daily where (M_ID = ' " & D_ID & " ')"
            db_cmd.Connection = db_c
            db_adp = New System.Data.SqlServerCe.SqlCeDataAdapter(db_cmd)
            DT_daily.Clear()
            db_adp.Fill(DT_daily)
            rewrite.year = DT_daily.Rows(0)("W_year").ToString
            rewrite.month = DT_daily.Rows(0)("W_month").ToString
            rewrite.day = DT_daily.Rows(0)("W_day").ToString
            rewrite.weather = DT_daily.Rows(0)("Weather").ToString
            rewrite.D_ID = D_ID
            rewrite.YearBox.Text = rewrite.year.ToString
            rewrite.MonthBox.Text = rewrite.month.ToString
            rewrite.DayBox.Text = rewrite.day.ToString
            rewrite.Weather1.Text = rewrite.weather.ToString
            rewrite.TextBox1.Text = DT_daily.Rows(0)("M_daily").ToString
            rewrite.moodBox.Text = DT_daily.Rows(0)("M_mood").ToString
            rewrite.TextBox2.Text = WhichWeek(DT_daily.Rows(0)("W_year"), DT_daily.Rows(0)("W_month"), DT_daily.Rows(0)("W_day"))
            rewrite.Button1.Enabled = True
            rewrite.Button2.Enabled = True
            rewrite.Show()

        Else
            MsgBox("请选择子结点")
        End If
    End Sub
End Class

⌨️ 快捷键说明

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