Capturing Mic input from sound card using directsound

I am working on a project to develop a software defined radio.I am an engineer with very limited programming experience.My first step is to familiarise with directx, I wanted to write a program to capture sound coming in from the line input of the soundcard (Mic) using directsound and display it or even just save it to a file. I have got a few ideas online and few sample codes. Below is the code i have been working with but it doesnt seem to work.

/// /// Recursive method that returns a target number in the form /// of an ArrayList of bytes with designated number of bytes. If not enough /// bytes to hold the targetnumber, will throw argumentexception. /// Should be used in a try-catch clause /// /// the value intended to convert /// number of bytes needed /// private ArrayList ToBytes(int targetnumber, short numofbytes) { int remainder, result; ArrayList returningarray;