Answer the question
In order to leave comments, you need to log in
How to properly use contextMenuStrip for ListView?
Hello, I have this code
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 250; i++)
{
ListViewItem item = new ListViewItem(new string[] { "Ivan", "Russia" });
listView1.Items.Add(item);
}
listView1.ContextMenuStrip = contextMenuStrip1;
ToolStripMenuItem item1 = new ToolStripMenuItem();
item1.Name = "NameMessageName";
item1.Text = "Name";
item1.Click += contextMenuStrip1_ItemClick;
contextMenuStrip1.Items.Add(item1);
}
private void contextMenuStrip1_ItemClick(object sender, EventArgs e)
{
MessageBox.Show(""); // Как вот тут вывести имя
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question