المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Foreach cannot operate on a 'method group'. Did you intend to invoke the 'method group'?



C# Programming
08-12-2010, 10:10 PM
From the code below, I am getting three different errors. The first has to do with the Listbox UpdateBegin/Endupdate. The next error has to do with the 'Foreach' statement and 'in'.

private void btnLoad_Click(object sender, RoutedEventArgs e)
{
//Declare an instance of the open file dialog...
OpenFileDialog dlg = new OpenFileDialog();

//The result of the open file dialog is either true or false.
Nullableresult = dlg.ShowDialog();

//Set properties for the dialog...
dlg.Title = "Select one or more media files";
dlg.Multiselect = true;
dlg.Filter = "Media files (*.mp3 | *.wav | *.wma | *.avi | *.mp4 | *.mpg | *.wmv)";

//If the result of the open file dialog was true then....
if (result == true)
{
//Stop the list box from drawing while items are added.
lstBxList.UpdateBegin();