CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Search Tool

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    Search Tool

    Hallo,

    This search button works fine, however, in the tooltip it shows "Record Found" as highlighted in the code below. What I want to do is to say how many records have been found. Lets say 2 records found it says "2 Records Found". I understand a count function must be included please could anyone update the code for me to accomodate that functionality.

    Thank you very much indeed. Please find the code below;

    Code:
    Private Sub btnPerformSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPerformSearch.Click
            ' Declare local variables...
            Dim intPosition As Integer
            ' Determine the appropriate item selected and set the
            ' Sort property of the DataView object...
            Select Case cboField.SelectedIndex
                Case 0 'PRACTICE
                    objDataView.Sort = "PRACTICE"
                Case 1 'HEALTH AUTHORITY
                    objDataView.Sort = "HA_NAME"
                Case 2 'REGION
                    objDataView.Sort = "REGION"
                Case 3 'TOWN
                    objDataView.Sort = "TOWN"
                Case 4 'POSTCODE
                    objDataView.Sort = "POSTCODE"
                Case 5 'CLINCOMP
                    objDataView.Sort = "CLINCOMP"
                Case 6 'GPRDSTATUS
                    objDataView.Sort = "GPRDSTATUS"
    
            End Select
            ' If the search field is not price then...
            If cboField.SelectedIndex < 7 Then
                ' Find the practice details
                intPosition = objDataView.Find(txtSearchCriteria.Text)
    
            End If
            If intPosition = -1 Then
                ' Display a message that the record was not found...
                ToolStripStatusLabel1.Text = "Record Not Found"
            Else
                ' Otherwise display a message that the record was
                ' found and reposition the CurrencyManager to that
                ' record...
                ToolStripStatusLabel1.Text = "Record Found"
                objCurrencyManager.Position = intPosition
            End If
            ' Show the current record position...
            ShowPosition()
    
    End Sub
    Last edited by HanneSThEGreaT; June 2nd, 2009 at 09:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured