C
Chris Clement
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.checkedListBox1' denotes a 'field'
where a 'class' was expected
public static void MenuItem_Click(object sender, System.EventArgs e)
{
for(int i = 0; i<checkedListBox1.Items.Count;i++)//<<<<line 1130
{
checkedListBox1.SetItemChecked(i,false);
}
}
Also getting an error saying: C:\...\newPrompt.cs(172): An object reference
is required for the nonstatic field, method, or property
'APP.mainForm.MenuItem'
private void button1_Click(object sender, System.EventArgs e)
{
for(int o = mainForm.historyMenuItem.MenuItems.Count-1; o>=0;o--)
mainForm.historyMenuItem.MenuItems.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.checkedListBox1' denotes a 'field'
where a 'class' was expected
public static void MenuItem_Click(object sender, System.EventArgs e)
{
for(int i = 0; i<checkedListBox1.Items.Count;i++)//<<<<line 1130
{
checkedListBox1.SetItemChecked(i,false);
}
}
Also getting an error saying: C:\...\newPrompt.cs(172): An object reference
is required for the nonstatic field, method, or property
'APP.mainForm.MenuItem'
private void button1_Click(object sender, System.EventArgs e)
{
for(int o = mainForm.historyMenuItem.MenuItems.Count-1; o>=0;o--)
mainForm.historyMenuItem.MenuItems.RemoveAt(o);
}
Help is appreciated.