0

Hi!

I wish to display a message displaying the text "NO RECORDS FOUND." in the datagrid when no records are returned. At the same time, I dont want even the datagrid header containing the field names to be displayed. Only the message should be displayed.

Can you plz help me out?

Thanks a lot.......................

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by williamrojas78
0

Hi

Do you want to display a message box?

If that is the case, then you have to evaluate the number of records in the database, if zero, then display a message.

If you don't want to dislpay anything on the datagrid, not event the names of the fields on the header, then set the datagrid.DataSource to Nothing; i think that will do it.

Something like this:

' fill the dataset
   ...
   ...
   ' then evaluate the number of records.
   if dataset.tables("yourTable").rows.count = 0 then
       msgbox("No records Found")
       datagrid.DataSource = nothing
   else
       'set the datagrid.dataSource to the table or to a dataView
      ....
   end if

Hope it helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.