St23aM,
    I have done what you are trying to do in my RollDice.NET app that I wrote using C#.  If you check out the sandbox on Channel9, you can download my app which contains source. 
    My app is a more of specialty dice roller for different rpg systems such as storyteller,champions,D6 by West End Games and very generic diceroller.

Matt