Click here to Skip to main content
15,917,862 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
C#
private void ListView1_Click(object sender, EventArgs e)
{
    int cds = ListView1.SelectedItems.Count - 1;
    for (int I = 0; I <= cds; I++)
    {
        MessageBox.Show("" + ListView1.SelectedItems[I].Text);
    }

}


I am trying to display info about selected item.

This is the error I am getting.
"The name 'ListView1' does not exist in the current context"
Posted
Updated 9-Dec-10 10:02am
v2

1 solution

You have to remember that C# is case sensitive.

If the name of the ListBox was assigned by the Visual Studio Editor, then it is almost certainly listBox1 with a lower case 'l'.

try:
C#
int cds = listView1.SelectedItems.Count - 1;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900