How to see if a Listview has rows?

E

Elmo Watson

I have a context menu strip, which is applied to the contextmenustrip
property of my listview

However, if there is no data in the listview, I really don't want it to
show?

I've tried several Listview properties, to see if they would work, but
haven't been able to come up with anything

How can I see if the listview has any rows of data in it?
 
N

Norman Yuan

if (ListView1.Items.Count==0)
{
//No item in the listview
}
else
{
//ListView contains item(s)
}
 
E

Elmo Watson

DOAH!
I totally missed that property somehow - - I was looking for listviewitems,
or something much more complicated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top