Private Sub lstPtName_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstPtName.Click
LoadPtData()
Me.txtNoRecs.Text = Me.BindingContext(dsPatient.Tables("Patients")).Count.ToString
Me.BindingContext(dsPatient.Tables("Patients")).Position = 0
Me.txtCurRec.Text = Me.BindingContext(dsPatient.Tables("Patients")).Position + 1
End Sub
Private Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
If Me.BindingContext(dsPatient.Tables("Patients")).Position < Me.BindingContext(dsPatient.Tables("Patients")).Count - 1 Then
Me.BindingContext(dsPatient.Tables("Patients")).Position = Me.BindingContext(dsPatient.Tables("Patients")).Position + 1
Me.txtCurRec.Text = Me.BindingContext(dsPatient.Tables("Patients")).Position + 1
End If
End Sub
Private Sub btnLast_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLast.Click
Me.BindingContext(dsPatient.Tables("Patients")).Position = Me.BindingContext(dsPatient.Tables("Patients")).Count - 1
Me.txtCurRec.Text = Me.BindingContext(dsPatient.Tables("Patients")).Position + 1
End Sub
Private Sub btnPrev_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrev.Click
If Me.BindingContext(dsPatient.Tables("Patients")).Position > 0 Then
Me.BindingContext(dsPatient.Tables("Patients")).Position = Me.BindingContext(dsPatient.Tables("Patients")).Position - 1
Me.txtCurRec.Text = Me.BindingContext(dsPatient.Tables("Patients")).Position + 1
End If
End Sub
Private Sub btnFirst_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFirst.Click
Me.BindingContext(dsPatient.Tables("Patients")).Position = 0
Me.txtCurRec.Text = Me.BindingContext(dsPatient.Tables("Patients")).Position + 1
End Sub
Sub LoadPtData()
dsPatient.Clear()
Dim daPatient As New SqlClient.SqlDataAdapter("SELECT * FROM RawData WHERE PtName = '" & lstPtName.Text & "'", conn)
Try
conn.Open()
dapatient.Fill(dsPatient, "Patients")
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
If txtPtName.DataBindings.Count = 0 Then
txtPtName.DataBindings.Add("Text", dsPatient, "Patients.PtName")
txtDOB.DataBindings.Add("Text", dsPatient, "Patients.PtDOB", True, DataSourceUpdateMode.OnPropertyChanged, Nothing, "MMM dd, yyyy")
txtSex.DataBindings.Add("Text", dsPatient, "Patients.PtSex")
txtPhys.DataBindings.Add("text", dsPatient, "Patients.PhyName")
txtTest.DataBindings.Add("Text", dsPatient, "Patients.Test")
txtResult.DataBindings.Add("Text", dsPatient, "Patients.Result")
txtUOM.DataBindings.Add("Text", dsPatient, "Patients.UOM")
txtCollDate.DataBindings.Add("Text", dsPatient, "Patients.CollectDate", True, DataSourceUpdateMode.OnPropertyChanged, Nothing, "MMM dd, yyyy")
txtCollTime.DataBindings.Add("Text", dsPatient, "Patients.CollectTime")
End If
End Sub
|