"The name 'SourceList' does not exist in the current context"

Jul 4, 2013 at 11:21 AM
Having used a/this following youtube example for using Naudio, Sourcelist, suddenly didn't work after transfering the code into another VIsual Studio-solution:
     List<NAudio.Wave.WaveInCapabilities> sources = new List<NAudio.Wave.WaveInCapabilities>();
        for (int i = 0; i < NAudio.Wave.WaveIn.DeviceCount; i++)
        {
            sources.Add(NAudio.Wave.WaveIn.GetCapabilities(i));
        }

        SourceList.Items.Clear();

        foreach (var source in sources)
        {
            ListViewItem item = new ListViewItem(source.ProductName);
            item.SubItems.Add(new ListViewItem.ListViewSubItem(item, source.Channels.ToString()));
                SourceList.Items.Add(item);
        }
  • -
Now the error-message in the thread subject appears.

/br Thomas Due, DK
Coordinator
Jul 4, 2013 at 12:08 PM
that just means you have no variable or field called SourceList. SourceList isn't part of NAudio, and so you'll need to copy more of the code from the demo if you want this to work.
Jul 4, 2013 at 2:07 PM
I found the error myself (sourcelist is a renamed listView-component)
Jul 4, 2013 at 2:08 PM
Yes, Mark .... thx (again my typical bad overview-capabilities haunts me :-/ )