Dynamically add to listbox

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);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top