You are on page 1of 26

LABORATORY MANAGEMENT SYSTEM

Purpose: well come Screen

Code for This form


Imports System.Windows.Forms Public Class MDIParent1 Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click Pinfo.Show() End Sub Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click Doctor_detail.Show() End Sub Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click Lab_details.show() End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click End End Sub Private Sub OptionsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OptionsToolStripMenuItem.Click Shell("calc.exe") End Sub

Private Sub NotepadToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotepadToolStripMenuItem.Click Shell("notepad") End Sub Private Sub OnScreenKeyboardToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OnScreenKeyboardToolStripMenuItem.Click Shell("osk") End Sub Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolBarToolStripMenuItem.Click CBC.Show() End Sub Private Sub CBCToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBCToolStripMenuItem.Click CBCR.Show() End Sub Private Sub MALERAIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MALERAIToolStripMenuItem.Click MPR.Show() End Sub Private Sub RECIPTToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RECIPTToolStripMenuItem1.Click rec1.Show() End Sub Private Sub ReciptToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReciptToolStripMenuItem.Click M_Parasite.Show() End Sub Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusBarToolStripMenuItem.Click HIV.Show() End Sub Private Sub HIVToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HIVToolStripMenuItem.Click HIVR.Show() End Sub End Class

Purpose: This form for patient all basic info

Code for this form


Imports System.Data.SqlClient Public Class Pinfo Dim da As SqlDataAdapter Dim ds As DataSet Dim sqlq As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim randomvalue As New Random 'create random object Dim randomhold As Integer 'generate random number For i As Integer = 0 To 9999 randomhold = randomvalue.Next(1, 9999) TextBox2.Text = randomhold Button1.Enabled = False

End Sub

Button3.Enabled = True Button2.Enabled = True Next

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dt As New DateTime dt = Today TextBox1.Text = (Date.Now) TextBox1.Enabled = False Button3.Enabled = False Button2.Enabled = False Call myconnection() End Sub Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged Dim age As Int32 age = Year(DateTime.Today()) - Year(DateTimePicker1.Value()) TextBox4.Text() = age If DateTimePicker1.Value() > System.DateTime.Today Then MsgBox("Selected Date is wrong") TextBox4.Text = "" End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Call myconnection() If con.State = ConnectionState.Open Then con.Close() Dim cmd As New SqlCommand() cmd.Connection = con con.Open() If (TextBox1.Text = "") Or (TextBox2.Text = "") Or (TextBox3.Text = "") Or (DateTimePicker1.Text = "") Or (TextBox4.Text = "") Or (TextBox5.Text = "") Or (TextBox6.Text = "") Then MsgBox("PLEASE ENTER ALL THE REQUIRED DATA") Else : cmd.CommandText = "INSERT INTO Pinfo (DATE,ID,NAME,BIRTHDATE,AGE,[ADD],[CONTACT NO])VALUES('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(TextBox3.Text) & "','" & Trim(DateTimePicker1.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) & "')" cmd.ExecuteNonQuery() If MsgBox("RECORD SAVED SUCCESSFULLY") = MsgBoxResult.Ok Then TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" con.Close() Button1.Enabled = True Button3.Enabled = False Button2.Enabled = False Me.Close() End If Testinfo.Show() End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox3.Text = "" TextBox4.Text = ""

TextBox5.Text = "" TextBox6.Text = "" End Sub Private Sub TextBox3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.LostFocus Dim s As String s = TextBox3.Text s = s.ToUpper TextBox3.Text = s End Sub Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress If (Char.IsPunctuation(e.KeyChar) = True Or Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox5_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.LostFocus Dim s As String s = TextBox5.Text s = s.ToUpper TextBox5.Text = s End Sub

Purpose: This form for Patients Test info


Code for this form
Dim cmd As New SqlClient.SqlCommand()

Private Sub Testinfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call myconnection() Dim strSQL As String = "SELECT * FROM Pinfo" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "Pinfo") With Me.ComboBox1 .DataSource = ds.Tables("Pinfo") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else MessageBox.Show("ADD PATIENT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With Dim dt As New DateTime dt = Today TextBox8.Text = (Date.Now) TextBox8.Enabled = False End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub TextBox6_GotFocus1(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox6.GotFocus End Sub Private Sub TextBox6_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox6.MouseClick TextBox6.Text = Val(TextBox2.Text) - Val(TextBox5.Text) TextBox7.Text = RupeesToWord(Val(TextBox2.Text)) End Sub

Private Sub TextBox5_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.LostFocus If Val(TextBox5.Text) > Val(TextBox2.Text) Then MessageBox.Show("Advance should not be more than Test Fee") TextBox5.Text = "" End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If (ComboBox1.Text = "") Or (TextBox9.Text = "") Or (TextBox1.Text = "") Or (ComboBox2.Text = "") Or (ComboBox3.Text = "") Or (ComboBox4.Text = "") Or (TextBox8.Text = "") Or (TextBox2.Text = "") Or (TextBox5.Text = "") Or (TextBox6.Text = "") Or (TextBox7.Text = "") Then MsgBox("PLEASE ENTER ALL THE REQUIRED DATA") Else Dim cmd As New SqlClient.SqlCommand()

cmd.Connection = con If con.State = ConnectionState.Open Then con.Close() con.Open() cmd.CommandText = "INSERT INTO Testinfo(ID,NAME,TESTNO,SC,RBD,RBH,IT1,IT2,IT3,DATE,TF,TOTAL,BAL,INWORD)VALUES('" & Trim(ComboBox1.Text) & "',' " & Trim(TextBox9.Text) & "','" & Trim(TextBox1.Text) & "','" & Trim(ComboBox2.Text) & "','" & Trim(ComboBox3.Text) & "','" & Trim(ComboBox4.Text) & "','" & Trim(CheckedListBox1.Text) & "','" & Trim(CheckedListBox2.Text) & "','" & Trim(CheckedListBox3.Text) & "','" & Trim(TextBox8.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) & "','" & Trim(TextBox7.Text) & "')" cmd.ExecuteNonQuery() MsgBox("RECORD SAVED SUCCESSFULLY") ComboBox1.Text = "" TextBox9.Text = "" TextBox1.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" ComboBox4.Text = "" CheckedListBox1.Text = "" 'ComboBox5.Text = "" TextBox2.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" con.Close() End If

End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ComboBox1.Text = "" TextBox9.Text = "" TextBox1.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" ComboBox4.Text = "" TextBox2.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Try ' Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True") Dim cmd As New SqlClient.SqlCommand() If con.State = ConnectionState.Open Then con.Close() cmd.Connection = con con.Open() cmd.CommandText = "SELECT * FROM Pinfo WHERE ID=(" + ComboBox1.Text + ");" cmd.ExecuteNonQuery() Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd.CommandText, con)

Dim ds As DataSet = New DataSet da.Fill(ds, "Pinfo") Dim dt As DataTable = ds.Tables("Pinfo") Dim row As DataRow For Each row In dt.Rows TextBox9.Text = row("NAME") TextBox1.Text = row("TESTNO") Next row If ds.Tables("Pinfo").Rows.Count = 0 Then MessageBox.Show("Sorry No Record Found Please Try Again!", " NEW LAB ", MessageBoxButtons.OK, MessageBoxIcon.Information) End If ' Close connection con.Close() Catch ex As SqlClient.SqlException ' End Try End Sub MessageBox.Show("Patient Not found" + ex.Message)

Purpose: This form for Malarial Analysis Record


Code for this form
Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True")

Private Sub M_Parasite_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'NewlabDataSet2.LAB_DETAIL' table. You can move, or remove it, as needed. Me.LAB_DETAILTableAdapter.Fill(Me.NewlabDataSet2.LAB_DETAIL) Dim strSQL As String = "SELECT * FROM Pinfo" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "Pinfo") With Me.ComboBox1 .DataSource = ds.Tables("Pinfo") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else MessageBox.Show("ADD PATIENT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With Dim dt As New DateTime dt = Today TextBox4.Text = (Date.Now) TextBox4.Enabled = False ComboBox3.Enabled = False End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged If ComboBox2.Text = "Seen" Then ComboBox3.Enabled = True End If If ComboBox2.Text = "Not Seen" Then ComboBox3.Enabled = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Try ' Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True") Dim cmd As New SqlClient.SqlCommand() If con.State = ConnectionState.Open Then con.Close() cmd.Connection = con con.Open() cmd.CommandText = "SELECT * FROM Pinfo WHERE ID=(" + ComboBox1.Text + ");" cmd.ExecuteNonQuery() Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd.CommandText, con) Dim ds As DataSet = New DataSet da.Fill(ds, "Pinfo") Dim dt As DataTable = ds.Tables("Pinfo") Dim row As DataRow For Each row In dt.Rows TextBox1.Text = row("NAME") TextBox2.Text = row("TESTNO") Next row If ds.Tables("Pinfo").Rows.Count = 0 Then MessageBox.Show("Sorry No Record Found Please Try Again!", " NEW LAB ", MessageBoxButtons.OK, MessageBoxIcon.Information) End If

' Close connection con.Close() Catch ex As SqlClient.SqlException MessageBox.Show("Patient Not found" + ex.Message) End Try End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim cmd As New SqlCommand() cmd.Connection = con If con.State = ConnectionState.Open Then con.Close() con.Open() If (ComboBox1.Text = "") Or (TextBox1.Text = "") Or (TextBox4.Text = "") Or (TextBox2.Text = "") Or (ComboBox4.Text = "") Or (ComboBox2.Text = "") Then MsgBox("PLEASE ENTER ALL THE REQUIRED DATA") Else : cmd.CommandText = "INSERT INTO M_Parasite (ID,NAME,DATE,TESTNO,LABNO,RESULT,TYPE)VALUES('" & Trim(ComboBox1.Text) & "','" & Trim(TextBox1.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(ComboBox4.Text) & "','" & Trim(ComboBox2.Text) & "','" & Trim(ComboBox3.Text) & "')" cmd.ExecuteNonQuery() MsgBox("RECORD SAVED SUCCESSFULLY") End If ComboBox1.Text = "" TextBox1.Text = "" TextBox2.Text = "" ComboBox4.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" con.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ComboBox1.Text = "" TextBox1.Text = "" TextBox2.Text = "" ComboBox4.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Try ' Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True") Dim cmd As New SqlClient.SqlCommand() If con.State = ConnectionState.Open Then con.Close() cmd.Connection = con con.Open() cmd.CommandText = "SELECT * FROM Pinfo WHERE ID=(" + ComboBox1.Text + ");" cmd.ExecuteNonQuery() Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd.CommandText, con) Dim ds As DataSet = New DataSet da.Fill(ds, "Pinfo") Dim dt As DataTable = ds.Tables("Pinfo") Dim row As DataRow

For Each row In dt.Rows TextBox1.Text = row("NAME") TextBox2.Text = row("TESTNO") Next row If ds.Tables("Pinfo").Rows.Count = 0 Then MessageBox.Show("Sorry No Record Found Please Try Again!", " NEW LAB ", MessageBoxButtons.OK, MessageBoxIcon.Information) End If ' Close connection con.Close() Catch ex As SqlClient.SqlException ' End Try End Sub MessageBox.Show("Patient Not found" + ex.Message)

Purpose: This form for HIV Analysis Record

Code for this form


Public Class HIV
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Try Dim cmd As New SqlClient.SqlCommand() If con.State = ConnectionState.Open Then con.Close() cmd.Connection = con con.Open() cmd.CommandText = "SELECT * FROM Pinfo WHERE ID=(" + ComboBox1.Text + ");" cmd.ExecuteNonQuery() Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd.CommandText, con) Dim ds As DataSet = New DataSet da.Fill(ds, "Pinfo") Dim dt As DataTable = ds.Tables("Pinfo") Dim row As DataRow For Each row In dt.Rows TextBox1.Text = row("NAME") TextBox2.Text = row("TESTNO") Next row If ds.Tables("Pinfo").Rows.Count = 0 Then MessageBox.Show("Sorry No Record Found Please Try Again!", " NEW LAB ", MessageBoxButtons.OK, MessageBoxIcon.Information) End If ' Close connection con.Close() Catch ex As SqlClient.SqlException MessageBox.Show("Patient Not found" + ex.Message) End Try End Sub Private Sub HIV_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'NewlabDataSet3.LAB_DETAIL' table. You can move, or remove it, as needed. Call myconnection() Me.LAB_DETAILTableAdapter.Fill(Me.NewlabDataSet3.LAB_DETAIL) Dim strSQL As String = "SELECT * FROM Pinfo" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "Pinfo") With Me.ComboBox1 .DataSource = ds.Tables("Pinfo") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else MessageBox.Show("ADD PATIENT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With Dim dt As New DateTime dt = Today TextBox4.Text = (Date.Now) TextBox4.Enabled = False

End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If con.State = ConnectionState.Open Then con.Close() Dim cmd As New SqlCommand() cmd.Connection = con con.Open() If (ComboBox1.Text = "") Or (TextBox1.Text = "") Or (TextBox4.Text = "") Or (TextBox2.Text = "") Or (TextBox3.Text = "") Or (ComboBox2.Text = "") Or (ComboBox3.Text = "") Then MsgBox("PLEASE ENTER ALL THE REQUIRED DATA") Else : cmd.CommandText = "INSERT INTO HIV(ID,NAME,DATE,TESTNO,LABNO,HIV_DUO,VALUE)VALUES('" & Trim(ComboBox1.Text) & "','" & Trim(TextBox1.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(ComboBox2.Text) & "','" & Trim(ComboBox3.Text) & "','" & Trim(TextBox3.Text) & "')" cmd.ExecuteNonQuery() MsgBox("RECORD SAVED SUCCESSFULLY") End If ComboBox1.Text = "" TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ComboBox1.Text = "" TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Try Dim cmd As New SqlClient.SqlCommand() If con.State = ConnectionState.Open Then con.Close() cmd.Connection = con con.Open() cmd.CommandText = "SELECT * FROM Pinfo WHERE ID=(" + ComboBox1.Text + ");" cmd.ExecuteNonQuery() Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd.CommandText, con) Dim ds As DataSet = New DataSet da.Fill(ds, "Pinfo") Dim dt As DataTable = ds.Tables("Pinfo") Dim row As DataRow For Each row In dt.Rows TextBox1.Text = row("NAME") TextBox2.Text = row("TESTNO") Next row If ds.Tables("Pinfo").Rows.Count = 0 Then MessageBox.Show("Sorry No Record Found Please Try Again!", " NEW LAB ", MessageBoxButtons.OK, MessageBoxIcon.Information) End If ' Close connection con.Close() Catch ex As SqlClient.SqlException

' MessageBox.Show("Patient Not found" + ex.Message) End Try End Sub

Purpose: This form is for evaluation of CBC test Code for this form
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim cmd As New SqlCommand() cmd.Connection = con con.Open()

If (TextBox1.Text = "") Or (TextBox2.Text = "") Or (ComboBox6.Text = "") Or (ComboBox1.Text = "") Or (TextBox4.Text = "") Or (TextBox5.Text = "") Or (TextBox6.Text = "") Or (TextBox7.Text = "") Or (TextBox8.Text = "") Or (TextBox9.Text = "") Or (TextBox10.Text = "") Or (TextBox11.Text = "") Or (TextBox12.Text = "") Or (ComboBox2.Text = "") Or (ComboBox3.Text = "") Or (ComboBox4.Text = "") Or (ComboBox5.Text = "") Then MsgBox("PLEASE ENTER ALL THE REQUIRED DATA") Else : cmd.CommandText = "INSERT INTO CBC (ID,NAME,DATE,TESTNO,LABNO, [Erythrocyte Count],Haemoglobin,MCH,Platelets,[Leucocyte Count],Neutrophils,Lymphocytes,eosinophils,[Platelets on smear],[RBC MORPHOLOGY], [RH type],[Blood Group])VALUES('" & Trim(ComboBox1.Text) & "','" & Trim(TextBox1.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(ComboBox6.Text) & "','" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) & "','" & Trim(TextBox7.Text) & "','" & Trim(TextBox8.Text) & "','" & Trim(TextBox9.Text) & "','" & Trim(TextBox10.Text) & "','" & Trim(TextBox11.Text) & "','" & Trim(TextBox12.Text) & "','" & Trim(ComboBox4.Text) & "','" & Trim(ComboBox5.Text) & "','" & Trim(ComboBox3.Text) & "','" & Trim(ComboBox2.Text) & "')" cmd.ExecuteNonQuery() MsgBox("RECORD SAVED SUCCESSFULLY") End If TextBox1.Text = "" TextBox2.Text = "" ComboBox6.Text = "" ComboBox1.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" TextBox9.Text = "" TextBox10.Text = "" TextBox11.Text = "" TextBox12.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" ComboBox4.Text = "" ComboBox5.Text = "" con.Close() End Sub Private Sub CBC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'NewlabDataSet1.LAB_DETAIL' table. You can move, or remove it, as needed. Call myconnection() If con.State = ConnectionState.Open Then con.Close() con.Open() Me.LAB_DETAILTableAdapter.Fill(Me.NewlabDataSet1.LAB_DETAIL)

Dim strSQL As String = "SELECT * FROM Pinfo" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "Pinfo") With Me.ComboBox1 .DataSource = ds.Tables("Pinfo") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else MessageBox.Show("ADD PATIENT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With Dim dt As New DateTime dt = Today TextBox4.Text = (Date.Now) TextBox4.Enabled = False End Sub

Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox7_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!")

End If End Sub Private Sub TextBox8_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox8.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox9_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox9.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox10_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox10.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox11_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox11.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub TextBox12_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox12.KeyPress If (Char.IsLetter(e.KeyChar) = True) And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter Numbers Only", , "WRONG INPUT!") End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

TextBox1.Text = "" TextBox2.Text = "" ComboBox6.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" TextBox9.Text = "" TextBox10.Text = "" TextBox11.Text = "" TextBox12.Text = "" ComboBox2.Text = "" ComboBox3.Text = "" ComboBox4.Text = "" ComboBox5.Text = "" End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Try cmd.Connection = con If con.State = ConnectionState.Open Then con.Close() con.Open() cmd.CommandText = "SELECT * FROM Pinfo WHERE ID=(" + ComboBox1.Text +

");"

cmd.ExecuteNonQuery() Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd.CommandText, con) Dim ds As DataSet = New DataSet da.Fill(ds, "Pinfo") Dim dt As DataTable = ds.Tables("Pinfo") Dim row As DataRow For Each row In dt.Rows TextBox1.Text = row("NAME") TextBox2.Text = row("TESTNO") Next row If ds.Tables("Pinfo").Rows.Count = 0 Then MessageBox.Show("Sorry No Record Found Please Try Again!", " NEW LAB ", MessageBoxButtons.OK, MessageBoxIcon.Information) End If ' Close connection con.Close() Catch ex As SqlClient.SqlException ' End Try End Sub MessageBox.Show("Patient Not found" + ex.Message)

Report of Three Tests 1) Report of Malarial Parasite

Code for this report


Public Class MPR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myConnection As New SqlClient.SqlConnection() myConnection.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True" Dim MyCommand As New SqlClient.SqlCommand() MyCommand.Connection = myConnection MyCommand.CommandText = "Select * from M_Parasite WHERE ID=(" + ComboBox1.Text + ")" MyCommand.CommandType = CommandType.Text

Dim MyDA As New SqlClient.SqlDataAdapter() MyDA.SelectCommand = MyCommand MyCommand.CommandType = CommandType.Text Dim myDS As New DataSet() 'This is our DataSet created at Design Time MyDA.Fill(myDS, "M_Parasite") 'You have to use the same name as that of your Dataset that you created during design time Dim oRpt As New MPReport() ' This is the Crystal Report file created at Design Time oRpt.SetDataSource(myDS) ' Set the SetDataSource property of the Report to the Dataset CrystalReportViewer1.ReportSource = oRpt ' Set the Crystal Report Viewer's property to the oRpt Report object that we created End Sub Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load Call myconnection() Dim strSQL As String = "SELECT * FROM M_Parasite" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "M_Parasite") With Me.ComboBox1 .DataSource = ds.Tables("M_Parasite") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else MessageBox.Show("ADD REPORT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With End Sub

Report of HIV test

Code for this report

Public Class HIVR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim myConnection As New SqlClient.SqlConnection() myConnection.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True" Dim MyCommand As New SqlClient.SqlCommand() MyCommand.Connection = myConnection MyCommand.CommandText = "Select * from HIV WHERE ID=(" + ComboBox1.Text +

")"

MyCommand.CommandType = CommandType.Text Dim MyDA As New SqlClient.SqlDataAdapter() MyDA.SelectCommand = MyCommand MyCommand.CommandType = CommandType.Text Dim myDS As New DataSet() 'This is our DataSet created at Design Time MyDA.Fill(myDS, "HIV") 'You have to use the same name as that of your Dataset that you created during design time Dim oRpt As New HIVReport() ' This is the Crystal Report file created at Design Time oRpt.SetDataSource(myDS) ' Set the SetDataSource property of the Report to the Dataset CrystalReportViewer1.ReportSource = oRpt ' Set the Crystal Report Viewer's property to the oRpt Report object that we created End Sub Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load Call myconnection() Dim strSQL As String = "SELECT * FROM HIV" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "HIV") With Me.ComboBox1 .DataSource = ds.Tables("HIV") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else

MessageBox.Show("ADD REPORT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With End Sub

Report of CBC test

Code for this report


Public Class CBCR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myConnection As New SqlClient.SqlConnection()

myConnection.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MAHESH\My Documents\Visual Studio 2008\Projects\New lab\New lab\Newlab.mdf;Integrated Security=True;User Instance=True" Dim MyCommand As New SqlClient.SqlCommand() MyCommand.Connection = myConnection MyCommand.CommandText = "Select * from CBC WHERE ID=(" + ComboBox1.Text + ")" MyCommand.CommandType = CommandType.Text Dim MyDA As New SqlClient.SqlDataAdapter() MyDA.SelectCommand = MyCommand MyCommand.CommandType = CommandType.Text Dim myDS As New DataSet() 'This is our DataSet created at Design Time MyDA.Fill(myDS, "CBC") 'You have to use the same name as that of your Dataset that you created during design time Dim oRpt As New CBCReport() ' This is the Crystal Report file created at Design Time oRpt.SetDataSource(myDS) ' Set the SetDataSource property of the Report to the Dataset CrystalReportViewer1.ReportSource = oRpt ' Set the Crystal Report Viewer's property to the oRpt Report object that we created End Sub Private Sub CBCR_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call myconnection() Dim strSQL As String = "SELECT * FROM CBC" Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, con) Dim ds As New DataSet da.Fill(ds, "CBC") With Me.ComboBox1 .DataSource = ds.Tables("CBC") .DisplayMember = "ID" .ValueMember = "ID" If .SelectedIndex = 0 Then Else MessageBox.Show("ADD REPORT INFORMATION FIRST!", "NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Close() End If End With End Sub

You might also like