%in Midrand+277-882-255-28 abortion pills for sale in midrand
Codes
1. ADD/UPDATE PATIENT
Imports System.Data.SqlClient
Public Class Frmain
Dim Uname1 As String
Dim UNAME2 As String
Dim s As Integer
Private Sub Frmain_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
SET1()
Me.Dispose()
End Sub
Private Sub Frmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Timer1.Start()
SET1()
FILDOC()
' FILDEP()
End Sub
Private Sub FILDEP()
Dim Con As SqlConnection
Dim Sql As String = Nothing
Dim Reader As SqlDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Cmd As SqlCommand
CMBDEP.Items.Clear()
Con = GetConnect()
Sql = "SELECT DEPARTMENT FROM TBLDEP"
'WHERE Uacct ='" & "Cashier" & "'
Cmd = New SqlCommand(Sql, conn)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
UNAME2 = Reader.Item(Columns)
Next
CMBDEP.Items.Add(Trim(UNAME2))
ComboRow += 1
End While
CMBDEP.Sorted = True
conn.Close()
End Sub
Private Sub FILDOC()
Dim Con As SqlConnection
Dim Sql As String = Nothing
Dim Reader As SqlDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Cmd As SqlCommand
2. CBODOC.Items.Clear()
Con = GetConnect()
Sql = "SELECT F_NAME FROM TBLDOCTOR WHERE DUTY ='" & "ON" & "'"
'WHERE Uacct ='" & "Cashier" & "'
Cmd = New SqlCommand(Sql, conn)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
Uname1 = Reader.Item(Columns)
Next
CBODOC.Items.Add(Trim(Uname1))
ComboRow += 1
End While
CBODOC.Sorted = True
conn.Close()
End Sub
Private Sub SET1()
TXTAD.Text = ""
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
TXTCS.Text = ""
Mtdt.Text = ""
'CMBDEP.Items.Clear()
'CMBDEP.Items.Add("OPD")
'CMBDEP.Items.Add("Ward")
FILDOC()
fildv2()
FILDEP()
s = 1
' DTBD.Value = Now.Date
'DTBD.MaxDate = Now.Date
End Sub
Private Sub fildv2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE STATUS >'" & "Admitted"
& "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
3. Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
LBLDT.Text = System.DateTime.Today.ToLongDateString
LBLTM.Text = System.DateTime.Now.ToLongTimeString
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
SKN()
End Sub
Private Sub SKN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" &
Trim(TXTN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub chkol()
If TXTN.Text = "" Or TXTAD.Text = "" Or TXTLN.Text = "" Or TXTMN.Text = "" Or
CBODOC.Text = "" Or CMBDEP.Text = "" Or DTBD.Value = Now.Date Or Label10.Text = "chk"
Then
MsgBox("Incomplete Data! Please fill-in all the fields!",
MsgBoxStyle.Critical)
Else
chk1()
4. End If
End Sub
Private Sub chk1()
If s = 1 Then
'+++++++++
GETID()
ISAVE()
SND()
'++++++++
Else
If Label10.Text = "chk" Then
MsgBox("Please Select Check-up or Admit", MsgBoxStyle.Critical)
ElseIf Label10.Text = "Check-up" Then
getrid()
SND()
End If
End If
End Sub
Private Sub IUPT()
End Sub
Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNADD.Click
chkol()
End Sub
Private Sub GETID()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim T As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(PID) FROM TBLPATIENT"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
T = cmdUser.ExecuteScalar()
LBLID.Text = T + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub ISAVE()
Dim check As Integer
Dim conn As SqlConnection
5. Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand ' 0 1 2 3
4 5 6 7 8 9 10 11
0 1 2 3 4
5
cmdUser1.CommandText = "INSERT INTO
TBLPATIENT(PID,LAST_NAME,FIRST_NAME,MIDDLE_NAME,BIRTHDATE,ADDRESS,STATUS,ROOM,CHECKIN_DAT
E,CHECKIN_TIME,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLID.Text & "','" & TXTLN.Text &
"','" & TXTN.Text & "','" & TXTMN.Text & "','" & Mtdt.Text & "','" & TXTAD.Text & "','" &
Label10.Text & "','" & "N/A" & "','" & LBLDT.Text & "','" & LBLTM.Text & "','" & "N/A" &
"','" & "N/A" & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
fildv2()
' getrid()
'
'iupdt()
End Sub
Private Sub getrid()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim R As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(RID) FROM TBLRECORD"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
R = cmdUser.ExecuteScalar()
LBLRID.Text = R + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
R = 0
6. End Try
conn.Close()
End Sub
Private Sub getdid()
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT DID,DEPARTMENT FROM TBLDOCTOR WHERE F_NAME='" &
CBODOC.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
LBLDID.Text = Trim(reader("DID"))
CMBDEP.Text = Trim(reader("DEPARTMENT"))
End If
con.Close()
End Sub
Private Sub iupdt()
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO
TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,TIME_RECORDED) VALUES('" &
LBLRID.Text & "','" & LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" &
TXTCS.Text & "','" & CMBDEP.Text & "','" & LBLDT.Text & "','" & LBLTM.Text & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
'
'
'
'
' MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
' Else
' MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly,
"Message :")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
SET1()
End Sub
Private Sub dv2_CellClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellClick
7. s = 2
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
' DTBD.Value = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
Mtdt.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
TXTAD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value())
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
s = 2
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
Mtdt.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
TXTAD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value())
End Sub
Private Sub CBODOC_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CBODOC.SelectedIndexChanged
' getdid()
End Sub
Private Sub BTNUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNUP.Click
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLPATIENT SET [LAST_NAME] ='" &
Trim(TXTLN.Text) & "', [FIRST_NAME] ='" & Trim(TXTN.Text) & "' , [MIDDLE_NAME] ='" &
Trim(TXTMN.Text) & "', [BIRTHDATE] ='" & Trim(Mtdt.Text) & "', [ADDRESS] ='" &
Trim(TXTAD.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
SET1()
End Sub
8. Private Sub BTNADM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub SND()
If Label10.Text = "Check-up" Then
Frmadmit.CMBRM.Visible = False
Else
Frmadmit.CMBRM.Visible = True
End If
Frmadmit.TXTN.Text = TXTN.Text
Frmadmit.TXTLN.Text = TXTLN.Text
Frmadmit.TXTMN.Text = TXTMN.Text
Frmadmit.TXTDOC.Text = CBODOC.Text
Frmadmit.TXTDEP.Text = CMBDEP.Text
Frmadmit.TXTAD.Text = TXTAD.Text
Frmadmit.LBLID.Text = LBLID.Text
Frmadmit.LBLDID.Text = LBLDID.Text
Frmadmit.LBLUID.Text = LBLUID.Text
Frmadmit.TXTBD.Text = Mtdt.Text
Frmadmit.TXTCS.Text = TXTCS.Text
Frmadmit.Label18.Text = Label10.Text
Frmadmit.Show()
Me.Hide()
SET1()
End Sub
Private Sub BTNEM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
' Me.Dispose()
End Sub
Private Sub TXTMN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTMN.TextChanged
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
SLN()
End Sub
Private Sub SLN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" &
Trim(TXTLN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
9. dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
SET1()
End Sub
Private Sub BTNAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNAC.Click
SET1()
Me.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub BTNLOG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNLOG.Click
Frmlogin.TXTPW.Text = ""
Frmlogin.TXTUN.Text = ""
Frmlogin.Show()
Me.Dispose()
End Sub
Private Sub TXTAD_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTAD.TextChanged
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub CBODOC_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles CBODOC.TextChanged
getdid()
End Sub
Private Sub CMBDEP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CMBDEP.SelectedIndexChanged
End Sub
10. Private Sub BTNVPR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub BTNCHK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Me.Hide()
End Sub
Private Sub RDCHK_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RDCHK.CheckedChanged
If RDCHK.Checked = True Then
Label10.Text = "Check-up"
End If
End Sub
Private Sub rdad_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rdad.CheckedChanged
If rdad.Checked = True Then
Label10.Text = "Admitted"
End If
End Sub
Private Sub DTBD_ValueChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DTBD.ValueChanged
End Sub
End Class
11. ADMIT PATIENT
Imports System.Data.SqlClient
Public Class Frmadmit
Dim W As Integer
Dim RM As String
Private Sub Frmadmit_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
SET2()
MDIFRM.Show()
Me.Dispose()
End Sub
Private Sub Frmadmit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub set1()
Timer1.Start()
FILSEL()
GETRID()
W = 1
FILRM()
End Sub
Private Sub FILRM()
Dim Con As SqlConnection
Dim Sql As String = Nothing
Dim Reader As SqlDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Cmd As SqlCommand
CMBRM.Items.Clear()
Con = GetConnect()
Sql = "SELECT ROOM_NO FROM TBLROOM WHERE CAPACITY > OCCUPANTS"
'WHERE Uacct ='" & "Cashier" & "'
Cmd = New SqlCommand(Sql, conn)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
RM = Reader.Item(Columns)
Next
CMBRM.Items.Add(Trim(RM))
ComboRow += 1
End While
conn.Close()
End Sub
Private Sub GETRID()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
12. Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim R As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(RID) FROM TBLRECORD"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
R = cmdUser.ExecuteScalar()
LBLRID.Text = R + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
R = 0
LBLRID.Text = "1"
End Try
conn.Close()
End Sub
Private Sub FILSEL()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLRECORD WHERE PID ='" &
Trim(LBLID.Text) & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLRECORD")
dv2.DataSource = dsuser
dv2.DataMember = "TBLRECORD"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub SET2()
TXTAD.Text = ""
TXTBD.Text = ""
TXTCS.Text = ""
TXTDEP.Text = ""
TXTDIA.Text = ""
TXTDOC.Text = ""
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
13. TXTP.Text = ""
TXTV.Text = ""
filol()
End Sub
Private Sub filol()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLRECORD"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLRECORD")
dv2.DataSource = dsuser
dv2.DataMember = "TBLRECORD"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
Label13.Text = System.DateTime.Today.ToLongDateString
Label14.Text = System.DateTime.Now.ToLongTimeString
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
SET2()
Frmain.Show()
Me.Dispose()
End Sub
Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNADD.Click
If TXTDIA.Text = "" Or TXTP.Text = "" Or TXTV.Text = "" Then
MsgBox("Incomplete Data! Please fill-in all the fields!",
MsgBoxStyle.Critical)
Else
ILAGAY()
End If
End Sub
Private Sub ILAGAY()
If Label18.Text = "Check-up" Then
'+++++++++++++++++++++++++++++
14. Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO
TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,RECORDED_TIME,VITAL_SIGNS,PRESCR
IPTION,DIAGNOSIS,ROOM,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLRID.Text & "','" &
LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" &
TXTDEP.Text & "','" & Now.Date.ToShortDateString & "','" &
System.DateTime.Now.ToLongTimeString & "','" & TXTV.Text & "','" & TXTP.Text & "','" &
TXTDIA.Text & "','" & "N/A" & "','" & "N/A" & "','" & "N/A" & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message
:")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
' iuprm()
' iupp()
set1()
SET2()
Frmain.Show()
Me.Dispose()
'+++++++++++++++++++++++++++++
Else
'================================
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
15. cmdUser1.CommandText = "INSERT INTO
TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,RECORDED_TIME,VITAL_SIGNS,PRESCR
IPTION,DIAGNOSIS,ROOM,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLRID.Text & "','" &
LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" &
TXTDEP.Text & "','" & Now.Date.ToShortDateString & "','" &
System.DateTime.Now.ToLongTimeString & "','" & TXTV.Text & "','" & TXTP.Text & "','" &
TXTDIA.Text & "','" & CMBRM.Text & "','" & "N/A" & "','" & "N/A" & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message
:")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
iuprm()
iupp()
set1()
SET2()
Frmain.Show()
Me.Dispose()
'============================
End If
End Sub
Private Sub iupp()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLPATIENT SET [STATUS] ='" & "Admitted" &
"',[ROOM] ='" & Trim(CMBRM.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
16. MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
End Sub
Private Sub iuprm()
Label17.Text = Val(Label17.Text) + 1
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLROOM SET [OCCUPANTS] ='" &
Trim(Label17.Text) & "' WHERE ROOM_NO ='" & Trim(CMBRM.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
End Sub
Private Sub BTNLOG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNLOG.Click
SET2()
Frmlogin.Show()
Me.Dispose()
End Sub
Private Sub BTNAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNAC.Click
Me.Dispose()
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
17. End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
End Sub
Private Sub CMBRM_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles CMBRM.TextChanged
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT OCCUPANTS FROM TBLROOM WHERE ROOM_NO='" &
CMBRM.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
Label17.Text = Trim(reader("OCCUPANTS"))
'CMBDEP.Text = Trim(reader("DEPARTMENT"))
End If
con.Close()
End Sub
Private Sub CMBRM_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CMBRM.SelectedIndexChanged
End Sub
End Class
18. RESET USER ACCOUNT
Imports System.Data.SqlClient
Public Class Frmacct
Private Sub Frmacct_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Frmain.BringToFront()
Frmain.Enabled = True
Me.Dispose()
End Sub
Private Sub Frmacct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub set1()
txtcpw.Text = ""
TXTPW.Text = ""
TXTUN.Text = ""
End Sub
Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNOK.Click
If Not txtcpw.Text = TXTPW.Text Or txtcpw.Text = "" Or TXTPW.Text = "" Then
MsgBox("Password was not confirmed! Please try again!",
MsgBoxStyle.Information)
Else
iupdt()
End If
End Sub
Private Sub iupdt()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLUSER SET [U_NAME] ='" & Trim(TXTUN.Text) &
"', [PASSWORD] ='" & Trim(TXTPW.Text) & "' WHERE ID ='" & Trim(lblid.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
20. CHECKOUT PATIENT
Imports System.Data.SqlClient
Public Class Frmchk
Private Sub Frmchk_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub set1()
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
fildv2()
Timer1.Start()
End Sub
Private Sub fildv2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE STATUS ='" & "Admitted"
& "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
SKN()
End Sub
Private Sub SKN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
21. conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" &
Trim(TXTN.Text & "%") & "' AND STATUS ='" & "Admitted" & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
SLN()
End Sub
Private Sub SLN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" &
Trim(TXTLN.Text & "%") & "' AND STATUS ='" & "Admitted" & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
22. TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
TextBox1.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(7).Value())
Label4.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(8).Value())
Label5.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(9).Value())
End Sub
Private Sub BTNCHK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCHK.Click
If TXTLN.Text = "" Or TXTMN.Text = "" Or TXTN.Text = "" Then
MsgBox("Incomplete data entry!", MsgBoxStyle.Information)
Else
iupp()
End If
End Sub
Private Sub iupp()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLPATIENT SET [STATUS] ='" & "Check-out" &
"',[CHECKOUT_DATE] ='" & Trim(LBLDT.Text) & "',[CHECKOUT_TIME] ='" & Trim(LBLTM.Text) &
"' WHERE PID ='" & Trim(LBLID.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
Label17.Text = Val(Label17.Text) - 1
iuprm()
End Sub
Private Sub iuprm()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLROOM SET [OCCUPANTS] ='" &
Trim(Label17.Text) & "' WHERE ROOM_NO ='" & Trim(TextBox1.Text) & "'"
23. check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
iuprec()
End Sub
Private Sub iuprec()
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLRECORD SET [CHECKOUT_DATE] ='" &
Trim(LBLDT.Text) & "',[CHECKOUT_TIME] ='" & Trim(LBLTM.Text) & "' WHERE PID ='" &
Trim(LBLID.Text) & "'AND DATE_RECORDED ='" & Trim(Label4.Text) & "'"
' check = cmdUser.ExecuteReader.RecordsAffected
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
set1()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT OCCUPANTS FROM TBLROOM WHERE ROOM_NO='" &
TextBox1.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
Label17.Text = Trim(reader("OCCUPANTS"))
'CMBDEP.Text = Trim(reader("DEPARTMENT"))
End If
con.Close()
End Sub
Private Sub BTNRET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNRET.Click
set1()
24. Me.Dispose()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
LBLDT.Text = System.DateTime.Today.ToLongDateString
LBLTM.Text = System.DateTime.Now.ToLongTimeString
End Sub
End Class
25. ADD/REMOVE DEPARTMENT
Imports System.Data.SqlClient
Public Class Frmdep
Dim d As Integer
Private Sub Frmdep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
FILD()
TXTN.Text = ""
d = 1
FILD2()
End Sub
Private Sub FILD2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim T As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(ID) FROM TBLDEP"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
T = cmdUser.ExecuteScalar()
LBLDEP.Text = T + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub FILD()
Dim conn1 As SqlConnection
Dim cmdUser1 As New SqlCommand
Dim daUser1 As New SqlDataAdapter
Dim dsuser1 As New DataSet
Dim dtUser1 As New DataTable
conn1 = GetConnect()
conn1.Open()
Try
cmdUser1 = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser1.CommandText = "SELECT * FROM TBLDEP"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser1.SelectCommand = cmdUser1
daUser1.Fill(dsuser1, "TBLDEP")
dv2.DataSource = dsuser1
dv2.DataMember = "TBLDEP"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
26. End Try
conn1.Close()
d = 1
TXTN.Text = ""
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLDEP WHERE DEPARTMENT like'" &
Trim(TXTN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLDEP")
dv2.DataSource = dsuser
dv2.DataMember = "TBLDEP"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNADD.Click
isv()
End Sub
Private Sub IKUM1()
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT * FROM TBLDEP WHERE DEPARTMENT='" & TXTN.Text &
"'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
MsgBox("Duplication of Record!", MsgBoxStyle.Exclamation)
TXTN.Focus()
TXTN.SelectAll()
Else
isv()
End If
con.Close()
End Sub
27. Private Sub isv()
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser1 As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO TBLDEP VALUES('" & LBLDEP.Text & "','" &
TXTN.Text & "')"
'(User_ID,User_name,Password,Fname,AccType,Logged)
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
FILD()
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
TXTN.Text = ""
Me.Dispose()
End Sub
Private Sub BTNUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNUP.Click
If Not TXTN.Text = "" And d = 2 Then
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser1 As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
28. cmdUser1.CommandText = "DELETE FROM TBLDEP WHERE ID ='" &
Trim(LBLDEP.Text) & "' "
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Deleted", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Deletion Failed Please try again", MsgBoxStyle.OkOnly,
"Message :")
End If
conn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
End If
FILD()
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
d = 2
LBLDEP.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
FILD()
End Sub
End Class
29. LOGIN FORM
Imports System.Data.SqlClient
Public Class Frmlogin
Private Sub Frmlogin_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
End
End Sub
Private Sub Frmlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNOK.Click
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT * FROM TBLUSER WHERE U_NAME='" & TXTUN.Text &
"'AND Password='" & TXTPW.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
lblnme.Text = Trim(reader("F_NAME"))
Label4.Text = Trim(reader("ID"))
MDIFRM.Show()
MDIFRM.Text = "Welcome" + " " + lblnme.Text
MDIFRM.LBLUID.Text = Label4.Text
MDIFRM.lblnme.Text = lblnme.Text
set1()
Me.Hide()
Else
MessageBox.Show("Invalid user name or password!")
set1()
TXTUN.Focus()
End If
End Sub
Private Sub set1()
If TXTUN.Text = "" Or TXTPW.Text = "" Then
BTNOK.Enabled = False
Else
BTNOK.Enabled = True
End If
TXTPW.Text = ""
TXTUN.Text = ""
TXTUN.Select()
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
set1()
End Sub
30. Private Sub TXTPW_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTPW.TextChanged
If Not TXTUN.Text = "" Or Not TXTPW.Text = "" Then
BTNOK.Enabled = True
Else
BTNOK.Enabled = False
End If
End Sub
Private Sub TXTUN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTUN.TextChanged
If Not TXTUN.Text = "" Or Not TXTPW.Text = "" Then
BTNOK.Enabled = True
Else
BTNOK.Enabled = False
End If
End Sub
End Class
31. FORM SERCH
Imports System.Data.SqlClient
Public Class Frmsearch
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
BLBBD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
LBLADDR.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value())
End Sub
Private Sub Frmsearch_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Frmain.Show()
Me.Dispose()
End Sub
Private Sub Frmsearch_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
SET1()
End Sub
Private Sub SET1()
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
FILDV2()
End Sub
Private Sub FILDV2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
32. End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
SKN()
End Sub
Private Sub SKN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" &
Trim(TXTN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
SLN()
End Sub
Private Sub SLN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" &
Trim(TXTLN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
33. MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub BTNSHOW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNSHOW.Click
If Not TXTLN.Text = "" Or Not TXTMN.Text = "" Or Not TXTN.Text = "" Then
SND()
FRMVPR.Show()
Frmain.Hide()
Me.Dispose()
Else
MsgBox("Incomplete data entry!", MsgBoxStyle.Information)
End If
End Sub
Private Sub SND()
FRMVPR.TXTN.Text = TXTN.Text
FRMVPR.TXTMN.Text = TXTMN.Text
FRMVPR.TXTLN.Text = TXTLN.Text
FRMVPR.LBLID.Text = LBLID.Text
FRMVPR.TXTBD.Text = BLBBD.Text
FRMVPR.TXTAD.Text = LBLADDR.Text
End Sub
Private Sub BTNCLR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCLR.Click
SET1()
End Sub
Private Sub BTNRET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNRET.Click
SET1()
Me.Dispose()
End Sub
Private Sub TXTMN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTMN.TextChanged
End Sub
End Class