Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Record Count on Search Results

Posted on 2006-10-26
2
Medium Priority
?
216 Views
Last Modified: 2010-04-23
Hi

I have some code that searches on various fields on an Access DB. Everything works fine, however I would like to populate a label with the number of records found.

This is my code for the search:

Private Sub txtSearch_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged

        Dim dvFilter As DataView = Nothing

        If TypeOf dgAssets.DataSource Is DataView Then
            dvFilter = CType(dgAssets.DataSource, DataView)
        ElseIf TypeOf dgAssets.DataSource Is DataTable Then
            dvFilter = CType(dgAssets.DataSource, DataTable).DefaultView
        End If

        If txtSearch.TextLength > 0 And RBEFCAssetTAG.Checked = True Then
            dvFilter.RowFilter = "EFCRef LIKE '" & txtSearch.Text & "*'"
        ElseIf txtSearch.TextLength > 0 And RBUser.Checked = True Then
            dvFilter.RowFilter = "User LIKE '" & txtSearch.Text & "*'"

        Else
            dvFilter.RowFilter = ""
        End If

        dgAssets.DataSource = dvFilter

    End Sub

Thanks
0
Comment
Question by:weight01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 2000 total points
ID: 17814740
dvFilter.Count should contain the number of records in the dataview after the filters have been applied.
0
 
LVL 1

Author Comment

by:weight01
ID: 17814854
Thanks ZeonFlash, your help is appreciated, that worked fine.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question