Sub ListViewPeopleEventHandler_ItemClick (PositionInListClicked As Int, ValuesInListClicked As Object)
' Update the details area.
'-------------------------
Dim valuesFromTheListView() As String
Dim oRecordSet As Cursor
valuesFromTheListView = ValuesInListClicked
' This value is the primary key to the database table and is hidden from the user.
'---------------------------------------------------------------------------------
intCurrentId = valuesFromTheListView(0)
oRecordSet = SQL.ExecQuery( _
"SELECT Id, FirstName, LastName, Address1, Address2, City, State, Zip, DateOfLastVisit " & _
"FROM PeopleToVisit " & _
"WHERE id = " & intCurrentId)
If oRecordSet.RowCount > 0 Then
oRecordSet.Position = 0
EditTextFirstName.Text = oRecordSet.GetString("FirstName")
EditTextLastName.Text = oRecordSet.GetString("LastName")
EditTextAddress1.Text = oRecordSet.GetString("Address1")
EditTextAddress2.Text = oRecordSet.GetString("Address2")
EditTextCity.Text = oRecordSet.GetString("City")
EditTextState.Text = oRecordSet.GetString("State")
EditTextZip.Text = oRecordSet.GetString("Zip")
EditTextDateOfLastVisit.Text = oRecordSet.GetString("DateOfLastVisit")
End If
EditTextFirstName.RequestFocus
EditTextFirstName.SelectAll
EditTextFirstName.Color = Colors.Cyan
EditTextFirstName.RequestFocus
EditTextLastName.Color = Colors.Cyan
EditTextAddress1.Color = Colors.Cyan
EditTextAddress2.Color = Colors.Cyan
EditTextCity.Color = Colors.Cyan
EditTextState.Color = Colors.Cyan
EditTextZip.Color = Colors.Cyan
EditTextDateOfLastVisit.Color = Colors.Cyan
tableMode = "Edit"
Activity.Title = "Maintenance - People To Visit *** EDIT ***"
ButtonDelete.Enabled = True
End Sub