Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

There is no row at position 0

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
I have the following code on the Page_Load event of my page:

Code:
Dim dvUnreadMailCount As Data.DataView = GetUnreadMailCount.Select(DataSourceSelectArguments.Empty)
Me.lblUnreadMailCount.Text = dvUnreadMailCount.ToTable.Rows(0)("Number_of_Unread_Emails")

This works fine if the number is greater than 0, however if the count comes back as 0 I get the error

Code:
There is no row at position 0

How can I hide/disable the label if the count is 0?

Thanks for any help
 
How about to check
dvUnreadMailCount.ToTable.Rows.Count == 0



Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top