Thursday, July 3, 2014

An Application Package on Hospital Management System (HMS) ~~ VisualBasic Code Snippet + GUI Design"

NOTE :- This application isn't developed for General Hospital Lagos. General Hospital's logo is only used for design purpose.
 Need more info about this application ? feel free to reach me.

Appointment Module

Doctor's Module

Patient Module

Report Screen

Emergency Module

Source Code

Imports System.Data
Imports System.Data.OleDb

Public Class HomePage   ' Class Begins

    Dim conn As New OleDbConnection
    Dim connmand As New OleDbCommand
    Dim connword = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\hms_db.mdb"
   

    Private Sub HomePage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'TODO: This line of code loads data into the 'Hms_dbDataSet11.Emergency_Record' table. You can move, or remove it, as needed.
        Me.Emergency_RecordTableAdapter.Fill(Me.Hms_dbDataSet11.Emergency_Record)
        'TODO: This line of code loads data into the 'Hms_dbDataSet10.Report' table. You can move, or remove it, as needed.
        Me.ReportTableAdapter.Fill(Me.Hms_dbDataSet10.Report)
        'TODO: This line of code loads data into the 'Hms_dbDataSet9.Patient_Record' table. You can move, or remove it, as needed.
        Me.Patient_RecordTableAdapter.Fill(Me.Hms_dbDataSet9.Patient_Record)
        'TODO: This line of code loads data into the 'Hms_dbDataSet8.Doctor_Record' table. You can move, or remove it, as needed.
        Me.Doctor_RecordTableAdapter.Fill(Me.Hms_dbDataSet8.Doctor_Record)
        'TODO: This line of code loads data into the 'Hms_dbDataSet7.Appointment_Record' table. You can move, or remove it, as needed.
    Me.Appointment_RecordTableAdapter.Fill(Me.Hms_dbDataSet7.Appointment_Record)

        conn.ConnectionString = connword
        conn.Open()

    End Sub


    Private Sub cmdsub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        connmand.CommandText = "insert into Report (Patient_Id, Report) values ('" & txtppiidd.Text & " ', '" & txtrr.Text & " ')"
        connmand.CommandType = CommandType.Text
        connmand.Connection = conn
        connmand.ExecuteNonQuery()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        connmand.CommandText = "insert into Appointment_Record (Token_No, Patient_Id, Name, Phone_No, Appointment_Date) values ('" & txttno.Text & " ', '" & txtpatientid.Text & " ', '" & txtpatientname.Text & " ', '" & txtphoneno.Text & " ', '" & txtadate.Text & " ')"
        connmand.CommandType = CommandType.Text
        connmand.Connection = conn
        connmand.ExecuteNonQuery()

    End Sub

    Private Sub pateint_update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        connmand.CommandText = "insert into Patient_Record (Patient_Code, Name, Gender, DOB, Address, Phone_No, Email, Occupation, Marital_Status, Spouse_Name, Children, Blood_Group, Allergies) values ('" & txtpcode.Text & " ', '" & txtpname.Text & " ', '" & txtgender.Text & " ', '" & txtdob.Text & " ', '" & txtaddress.Text & " ', '" & txtpno.Text & " ', '" & txteid.Text & " ', '" & txtoccupation.Text & " ', '" & txtmstatus.Text & " ', '" & txtsname.Text & " ', '" & txtchildren.Text & " ', '" & txtbgroup.Text & " ', '" & txtallergies.Text & " ')"
        connmand.CommandType = CommandType.Text
        connmand.Connection = conn
        connmand.ExecuteNonQuery()

    End Sub

    Private Sub cmdup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        connmand.CommandText = "insert into Emergency_Record (Patient_Code, Name, Gender, DOB, Address, Blood_Group, Emergency_Report) values ('" & txtppcode.Text & " ', '" & txtppname.Text & " ', '" & txtpgender.Text & " ', '" & txtpdob.Text & " ', '" & txtpadd.Text & " ', '" & txtpblood.Text & " ', '" & txtereport.Text & " ')"
        connmand.CommandType = CommandType.Text
        connmand.Connection = conn
        connmand.ExecuteNonQuery()

    End Sub

    Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

        txtdob.Text = DateTimePicker1.Text

    End Sub

    Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

        txtadate.Text = DateTimePicker2.Text

    End Sub

    Private Sub DateTimePicker3_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

        txtpdob.Text = DateTimePicker3.Text

    End Sub

    Private Sub btnhome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhome.Click

        ' TabControl1.SelectedTab() = TabPage1

    End Sub

    Private Sub btnapp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnapp.Click

        TabControl1.SelectedTab() = TabPage2

    End Sub

    Private Sub btndoc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndoc.Click

        TabControl1.SelectedTab() = TabPage3

    End Sub

    Private Sub btnPatient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPatient.Click

        TabControl1.SelectedTab() = TabPage4

    End Sub

    Private Sub btnreport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnreport.Click

        TabControl1.SelectedTab() = TabPage5

    End Sub

    Private Sub btnemergency_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnemergency.Click

        TabControl1.SelectedTab() = TabPage6

    End Sub

    Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        'TODO: This line of code loads data into the 'Hms_dbDataSet7.Appointment_Record' table. You can move, or remove it, as needed.
        Me.Appointment_RecordTableAdapter.Fill(Me.Hms_dbDataSet7.Appointment_Record)

        txttno.Text = ""
        txtpatientid.Text = ""
        txtpatientname.Text = ""
        txtphoneno.Text = ""
        txtadate.Text = ""

    End Sub

    Private Sub pateint_update_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pateint_update.Click

        Me.Patient_RecordTableAdapter.Fill(Me.Hms_dbDataSet9.Patient_Record)

        txtpcode.Text = ""
        txtpname.Text = ""
        txtgender.Text = ""

        txtdob.Text = ""
        txtaddress.Text = ""
        txtpno.Text = ""
        txteid.Text = ""
        txtoccupation.Text = ""
        txtmstatus.Text = ""
        txtsname.Text = ""
        txtchildren.Text = ""
        txtbgroup.Text = ""
        txtallergies.Text = ""

    End Sub

    Private Sub cmdsub_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsub.Click

        Me.ReportTableAdapter.Fill(Me.Hms_dbDataSet10.Report)

        txtppiidd.Text = ""
        txtrr.Text = ""

    End Sub

    Private Sub cmdup_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdup.Click

        Me.Emergency_RecordTableAdapter.Fill(Me.Hms_dbDataSet11.Emergency_Record)

        txtppcode.Text = ""
        txtppname.Text = ""
        txtpgender.Text = ""
        txtpdob.Text = ""
        txtpadd.Text = ""
        txtpblood.Text = ""
        txtereport.Text = ""

    End Sub

End Class 'Class ends here