Johnny Hill

Johnny Hill

  • NA
  • 1
  • 1.5k

ListViewItem does not contain a constructor that takes 1 arg

Jul 29 2015 10:24 AM
Hi, sorry - I'm new to C#. I'm currently looking into audio programming with NAudio, there's not too much documentation - it's mostly just demo code projects. Following along with one I ran into a bit of trouble, the code is for a Windows Form application and I'm doing mine in WPF.
 
What the below code does (I'm pretty sure) is it attempts to add the list of available devices to my ListView control.  (EDIT: I omitted some code I felt not relevant to the issue, about four lines.)
 
The full error is present in the title, save the last few letters of the word 'arguments'.
 


(Also, sorry I can't locate the code snippet button so I'm using 'formatted' in the meanwhile. EDIT: Formatted is garbage.)


My code:

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


}


Answers (1)