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.......................


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
       'set the datagrid.dataSource to the table or to a dataView
   end if

Hope it helps