I have options such as Add, Delete, and Refresh in my ContextMenuStrip, which should appear when the user right-clicks on the ListView.
How to disable the update menu if there are no items in the list view?
You can try using the MouseDown event:
void listView1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { updateToolStripMenuItem.Enabled = (listView1.Items.Count > 0); } }
Use the ContextMenuStrip.Opening event.
if (ListBox1.Items.Count == 0) { ItemAToolStripMenuItem.Enabled = false; }
http://i.imgur.com/8DlqvDZ.png