R
Rotsey
Hi,
I am trying to add a generic list of items to a listbox using AddRange.
The code is below, I am getting a error.
The documentation say you can add a object[] to AddRange.
Any ideas?
rotsey
Error 2 Argument '1': cannot convert from
'DrivePieExplorer.Class.DuplicateFileName[]' to
'System.Windows.Forms.ListBox.ObjectCollection' C:\Documents and
Settings\Malcolm Smith\My Documents\Visual Studio
2005\Projects\DrivePieExplorer\DrivePieExplorer\frmDuplicates.cs 70 37
DrivePieExplorer
void mWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.Text = string.Format("Find Duplicates: {0} - {1}%",mDriveData.Drive,
e.ProgressPercentage);
toolStripProgressBar1.Value = e.ProgressPercentage;
List<DuplicateFileName> filelist = e.UserState as List<DuplicateFileName>;
DuplicateFileName[] files = filelist.ToArray();
listBox1.Items.AddRange(files);
}
I am trying to add a generic list of items to a listbox using AddRange.
The code is below, I am getting a error.
The documentation say you can add a object[] to AddRange.
Any ideas?
rotsey
Error 2 Argument '1': cannot convert from
'DrivePieExplorer.Class.DuplicateFileName[]' to
'System.Windows.Forms.ListBox.ObjectCollection' C:\Documents and
Settings\Malcolm Smith\My Documents\Visual Studio
2005\Projects\DrivePieExplorer\DrivePieExplorer\frmDuplicates.cs 70 37
DrivePieExplorer
void mWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.Text = string.Format("Find Duplicates: {0} - {1}%",mDriveData.Drive,
e.ProgressPercentage);
toolStripProgressBar1.Value = e.ProgressPercentage;
List<DuplicateFileName> filelist = e.UserState as List<DuplicateFileName>;
DuplicateFileName[] files = filelist.ToArray();
listBox1.Items.AddRange(files);
}