frm_app.vb

来自「application file which contains the note」· VB 代码 · 共 785 行 · 第 1/3 页

VB
785
字号
        MyCommand3 = New OleDbCommand("Select * from Physicians", MyConnection2)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "appointment")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("appointment")
        MyReader = MyCommand2.ExecuteReader()
        MyReader2 = MyCommand3.ExecuteReader()
        While MyReader.Read
            ComboBox1.Items.Add(MyReader("patcode"))
        End While
        While MyReader2.Read
            ComboBox2.Items.Add(MyReader2("phycode"))
        End While
        MyConnection.Close()
        MyConnection2.Close()
        MyCommand.Dispose()
        MyReader.Close()
        MyReader2.Close()
        MyCommand2.dispose()
        MyCommand3.dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.Close()
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        MyConnection.Open()
        MyCommand = New OleDbCommand("SELECT * FROM appointment where patcode = '" & ComboBox1.Text & "' ", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            TextBox1.Text = MyReader("appointid")
            TextBox2.Text = MyReader("appointdate")
            TextBox3.Text = MyReader("appointtime")
            TextBox4.Text = MyReader("appointdes")
            ComboBox2.Text = MyReader("phycode")
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.dispose()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label5.Text = currentTime.Now.ToShortTimeString
    End Sub
    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        MyConnection3.Open()
        MyCommand = New OleDbCommand("SELECT * FROM appointment where phycode = '" & ComboBox2.Text & "' ", MyConnection3)
        Try
            MyReader3 = MyCommand.ExecuteReader()
        Catch c As Exception
            MsgBox(c.ToString)
        Finally
        End Try
        While MyReader3.Read
            TextBox1.Text = MyReader3("appointid")
            TextBox2.Text = MyReader3("appointdate")
            TextBox3.Text = MyReader3("appointtime")
            TextBox4.Text = MyReader3("appointdes")
            ComboBox1.Text = MyReader3("patcode")
        End While
        MyConnection3.Close()
        MyReader3.Close()
        MyCommand.dispose()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Button2.Visible = False
        Button2.Enabled = False
        Button5.Visible = True
        Button5.Enabled = True
        enablefields()
        getid()
        TextBox1.Text = appointmentid()
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim appid = TextBox1.Text
        Dim appdate = TextBox2.Text
        Dim apptime = TextBox3.Text
        Dim appdes = TextBox4.Text
        Dim patc = ComboBox1.Text
        Dim phyc = ComboBox2.Text
        Dim da = currentDate.Now.ToShortDateString()

        If appcheck() = True Then
            MsgBox(TextBox6.Text + " has already an appointmanet on the date " + TextBox5.Text + ", at " + TextBox7.Text, MsgBoxStyle.OKOnly.Exclamation, "PrisLogix's PIS")
            MsgBox("The time for the appointment should be " + suggesttime2(TextBox3.Text) + " on the same date", MsgBoxStyle.Information, "PrisLogix's PIS")
        Else
            MyConnection.Open()
            Dim icmd As String
            icmd = " INSERT INTO appointment VALUES ('" & appid & "' , '" & appdate & "', '" & da & "', '" & patc & "', '" & phyc & "' , '" & appdes & "', '" & apptime & "') "
            MyCommand = New OleDbCommand(icmd, MyConnection)
            Try
                MyCommand.ExecuteNonQuery()
            Catch c As Exception
                MsgBox(c.ToString)
            Finally
            End Try
            DataGrid1.Update()
            MyConnection.Close()
            MyCommand.dispose()
            MsgBox("New appointment recorded", MsgBoxStyle.OKOnly.Information, "PrisLogix's PIS")
            Button2.Visible = True
            Button2.Enabled = True
            Button5.Visible = False
            Button5.Enabled = False
            clearfields()
            disablefields()
        End If
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If idcheck() = True Then
            MsgBox("Please enter the appointment id if you want to edit an appointment", MsgBoxStyle.Information, "PrisLogix's PIS")
        Else
            enablefields()
            formfill()
            Button6.Visible = True
            Button3.Visible = False
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ref3 = New frm_srhapp
        ref3.mdiparent = Me.MdiParent
        ref3.show()
    End Sub
    Private Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click
        disablefields()
        updateapp()
        clearfields()
        Button6.Visible = False
        Button3.Visible = True
        MsgBox("Appointment Number" + TextBox1.Text + "has been updated", MsgBoxStyle.Information, "PrisLogix's PIS")
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If idcheck() = True Then
            MsgBox("Please Enter in the id you would like to delete", MsgBoxStyle.Exclamation, "PrisLogix's PIS")
        End If
        deleteapp()
        clearfields()
        MsgBox("Appoint Number" + TextBox1.Text + "Has been Deleted", MsgBoxStyle.Information, "PrisLogix's PIS")
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        clearfields()
        disablefields()
    End Sub
#End Region
#Region "GLOW CODE"


    Private Sub MouseEnterEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles Button1.MouseEnter, Button2.MouseEnter, Button3.MouseEnter, Button4.MouseEnter, Button5.MouseEnter, Button6.MouseEnter, Button7.MouseEnter, Button8.MouseEnter

        ' A simple event handler that fires when the user's mouse arrow rolls 
        ' over any of the buttons.  It passes the button's identity to the Glow sub.

        Dim ctrl As Control = CType(sender, Control)
        Glow(ctrl, True)

    End Sub

    Private Sub MouseLeaveEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Button1.MouseLeave, Button2.MouseLeave, Button3.MouseLeave, Button4.MouseLeave, Button5.MouseLeave, Button6.MouseLeave, Button7.MouseLeave, Button8.MouseLeave

        ' A simple event handler that fires when the user's mouse arrow leaves the
        ' area of any of the buttons.  It passes the button's identity to the Glow sub.

        Dim ctrl As Control = CType(sender, Control)
        Glow(ctrl, False)

    End Sub

    Private Sub Glow(ByVal ctrl As Control, ByVal Hovering As Boolean)

        Dim Sb_R, Sb_G, Sb_B As Int16 '           <--- RGB values for the starting backcolor
        Dim Sf_R, Sf_G, Sf_B As Int16 '           <--- RGB values for the starting forecolor
        Dim Eb_R, Eb_G, Eb_B As Int16 '           <--- RGB values for the ending backcolor
        Dim Ef_R, Ef_G, Ef_B As Int16 '           <--- RGB values for the ending forecolor

        Select Case Hovering  ' True for MouseEnter, False for MouseLeave
            Case True
                Sb_R = SystemColors.Control.R           ' Assign the variables the 
                Sb_G = SystemColors.Control.G           ' appropriate values based
                Sb_B = SystemColors.Control.B           ' on system-defined colors
                '                                         for control and control
                Sf_R = SystemColors.ControlText.R       ' text.
                Sf_G = SystemColors.ControlText.G
                Sf_B = SystemColors.ControlText.B

                Eb_R = SystemColors.ActiveCaption.R     ' Assign the variables the
                Eb_G = SystemColors.ActiveCaption.G     ' appropriate values based
                Eb_B = SystemColors.ActiveCaption.B     ' on system-defined colors
                '                                         for the title bar and the
                Ef_R = SystemColors.ActiveCaptionText.R ' title bar's text.
                Ef_G = SystemColors.ActiveCaptionText.G
                Ef_B = SystemColors.ActiveCaptionText.B
            Case False
                Sb_R = SystemColors.ActiveCaption.R     ' Assign the variables the
                Sb_G = SystemColors.ActiveCaption.G     ' appropriate values based
                Sb_B = SystemColors.ActiveCaption.B     ' on system-defined colors
                '                                         for the title bar and the
                Sf_R = SystemColors.ActiveCaptionText.R ' title bar's text.
                Sf_G = SystemColors.ActiveCaptionText.G
                Sf_B = SystemColors.ActiveCaptionText.B

                Eb_R = SystemColors.Control.R           ' Assign the variables the 
                Eb_G = SystemColors.Control.G           ' appropriate values based
                Eb_B = SystemColors.Control.B           ' on system-defined colors
                '                                         for control and control
                Ef_R = SystemColors.ControlText.R       ' text.
                Ef_G = SystemColors.ControlText.G
                Ef_B = SystemColors.ControlText.B
        End Select

        Dim b_RIncrement As Int16 = Round(((Eb_R - Sb_R) / 16), 0)      ' Find the increments that
        Dim b_GIncrement As Int16 = Round(((Eb_G - Sb_G) / 16), 0)      ' the RGB values will take;
        Dim b_BIncrement As Int16 = Round(((Eb_B - Sb_B) / 16), 0)      ' 1/16th of the difference
        '                                                                 between the start and end
        Dim f_RIncrement As Int16 = Round(((Ef_R - Sf_R) / 16), 0)      ' values, rounded to the 
        Dim f_GIncrement As Int16 = Round(((Ef_G - Sf_G) / 16), 0)      ' nearest integer.
        Dim f_BIncrement As Int16 = Round(((Ef_B - Sf_B) / 16), 0)

        Dim bR As Int16 = Sb_R ' \
        Dim bG As Int16 = Sb_G '  }--  the RGB values for the backcolor as it changes.
        Dim bB As Int16 = Sb_B ' /

        Dim fR As Int16 = Sf_R ' \
        Dim fG As Int16 = Sf_G '  }--  the RGB values for the forecolor as it changes.
        Dim fB As Int16 = Sf_B ' /

        Dim count As Int16
        For count = 0 To 14
            bR += b_RIncrement          ' Add the appropriate increments to the 
            bG += b_GIncrement          ' RGB values.  The result is a nifty
            bB += b_BIncrement          ' "cross-fade" effect.
            fR += f_RIncrement
            fG += f_GIncrement
            fB += f_BIncrement

            ctrl.BackColor = Color.FromArgb(bR, bG, bB)   ' Repaint the button using the
            ctrl.ForeColor = Color.FromArgb(fR, fG, fB)   ' current RGB values, and refresh
            ctrl.Refresh()                                ' the button.

            Threading.Thread.Sleep(30 - (count * 2))      ' Wait a certain number of milliseconds,
            '                                               which is a factor of the current count.
            '                                               I tweaked these numbers to get a decent
            '                                               effect; feel free to adjust these 
            '                                               numbers to achieve an effect you like.
        Next
        Select Case Hovering
            Case True
                ctrl.BackColor = SystemColors.InactiveCaption         ' Finish the effect by painting 
                ctrl.ForeColor = SystemColors.InactiveCaptionText      ' the control with it's final
            Case False                                              ' look, depending on whether
                ctrl.BackColor = SystemColors.Control               ' we're fading in or out.
                ctrl.ForeColor = SystemColors.ControlText
        End Select
    End Sub



#End Region
End Class

⌨️ 快捷键说明

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