I didn't write this code so I'm not sure what is going on with this error.
checkedListBox1 is a public object. Why does the error say that it is
expecting a 'class' in a for loop? Is it because the method is static?
Here is the error and the code:
C:\...\Form1.cs (1130): 'APP.mainForm.c heckedListBox1' denotes a 'field'
where a 'class' was expected
public static void MenuItem_Click( object sender, System.EventArg s e)
{
for(int i = 0; i<checkedListBo x1.Items.Count; i++)//<<<<line 1130
{
checkedListBox1 .SetItemChecked (i,false);
}
}
Also getting an error saying: C:\...\newPromp t.cs(172): An object reference
is required for the nonstatic field, method, or property
'APP.mainForm.M enuItem'
private void button1_Click(o bject sender, System.EventArg s e)
{
for(int o = mainForm.histor yMenuItem.MenuI tems.Count-1; o>=0;o--)
mainForm.histor yMenuItem.MenuI tems.RemoveAt(o );
}
Help is appreciated.
checkedListBox1 is a public object. Why does the error say that it is
expecting a 'class' in a for loop? Is it because the method is static?
Here is the error and the code:
C:\...\Form1.cs (1130): 'APP.mainForm.c heckedListBox1' denotes a 'field'
where a 'class' was expected
public static void MenuItem_Click( object sender, System.EventArg s e)
{
for(int i = 0; i<checkedListBo x1.Items.Count; i++)//<<<<line 1130
{
checkedListBox1 .SetItemChecked (i,false);
}
}
Also getting an error saying: C:\...\newPromp t.cs(172): An object reference
is required for the nonstatic field, method, or property
'APP.mainForm.M enuItem'
private void button1_Click(o bject sender, System.EventArg s e)
{
for(int o = mainForm.histor yMenuItem.MenuI tems.Count-1; o>=0;o--)
mainForm.histor yMenuItem.MenuI tems.RemoveAt(o );
}
Help is appreciated.
Comment