Click here to Skip to main content
14,970,229 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All

I would like to know how i can indicate to the user by a display message the row they searched for in a datagridview is not found.

For instance, i have a textbox and button which i filter the gridview. but i would like to provide a message to the user if the row appears to be empty.

i am using 3tier design so this all will be happening on the presentation layer.

C#
private void btnSearch_Click(object sender, EventArgs e)
{
      if (txtSearchVisitorSurname.Text == String.Empty)
      {
          MessageBox.Show("Please provide a last name to search for", "Search option", MessageBoxButtons.OK, MessageBoxIcon.Information);
          return;
      }
      else
      { 
          rdoShowAll.Checked = false;
          dgvAllVisitors.DataSource = bl.GetAllVisitorsBySurname(txtSearchVisitorSurname.Text);
          dgvAllVisitors.ClearSelection();
          dgvAllVisitors.ReadOnly = true;
      }
}




thanks
Posted
Updated 29-Sep-13 23:52pm
v2
Comments
dibyaaryan007 30-Sep-13 5:58am
   
hello .
what you exactly want?
you want to search the value given in textbox inside grid view with highlight or the value of selected row in message.?
   
So, what's the issue?

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