Hello All, I am having a problem using a search function within a dataview. My sample data was 3 names then 5.
First set was:
A smith
b smith
c smith
then i added:
d smith
e smith
(I was Searching by last name criteria)
I discoverd that my searching was taking me to the middle record of the search instead of the first record??
on my first test i was going to Record "B smith" as my starting record in my form for the search then when i added the other two then "C smith" became my starting record from my search. I am unsure what is occurring and any insight would be apreciated.
below is included my actual code...
VB Code:
Dim objDataView As DataView // * * * * // Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click Dim storeRecordPosition As Integer selectCriteria() storeRecordPosition = objDataView.Find(txtSearchCriteria.Text) If storeRecordPosition = -1 Then StatusBar1.Text = "Record Not Found" Else StatusBar1.Text = "Record Found" objCurrencyManager.Position = storeRecordPosition End If End Sub Private Sub selectCriteria() Select Case cboCriteria.SelectedIndex Case 0 'First Name objDataView.Sort = "FirstName" Case 1 'Last Name objDataView.Sort = "LastName" Case 2 'State objDataView.Sort = "State" Case 3 'Zip objDataView.Sort = "Zip" End Select StatusBar1.Text = "Sorted by " & cboCriteria.SelectedItem End Sub




Reply With Quote