Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i can only search data. how to display no data found?

What I have tried:

Private Sub SearchToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SearchToolStripMenuItem.Click
      
        Dim DV As New DataView(dbDataSet)
        DV.RowFilter = String.Format("ear_number Like '%{0}%'", TextBox1.Text)
        DataGridView2.DataSource = DV


    End Sub
Posted
Updated 8-Apr-19 1:27am

1 solution

You could use the DataView.Count property - DataView.Count Property (System.Data) | Microsoft Docs[^] If it returns 0 then put your "No Data Found" text into the first Column of DataGridView2 otherwise set the DataSource
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900