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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.