SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Documentation seems a little sparce.

Last post 08-24-2010 11:11 PM by Torby. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 08-24-2010 11:11 PM

    • Torby
    • Not Ranked
    • Joined on 08-24-2010
    • Posts 1

    Documentation seems a little sparce.

    I'm trying to put the example code into a VS 2008 windows form application, but I get a runtime error on foreach (Bus bus in Bus.Busses) that it's reading unallocated memory. Perhaps I'm missing an initialization somewhere?

    Here's the program:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    using 

    System;

    using 

    System.Collections.Generic;

    using 

    System.ComponentModel;

    using 

    System.Data;

    using 

    System.Drawing;

    using 

    System.Linq;

    using 

    System.Text;

    using 

    System.Windows.Forms;

    using 

    ICSharpCode.USBlib;

    namespace 

    usbmess

    {

     

     

    public partial class Form1 :

    Form

    {

     

     

    public

    Form1()

    {

    InitializeComponent();

    }

     

     

    private void Form1_Load(object sender, EventArgs e)

    {

     

     

    foreach (Bus bus in Bus.Busses)

    {

    listBox1.Items.Add(bus);

     

     

    // Console.WriteLine(bus);

     

     

    foreach (Descriptor descriptor in bus.Descriptors)

    {

     

     

    //Console.WriteLine("\t" + descriptor);

    listBox1.Items.Add(

    " -- " + descriptor);

     

     

    try

    {

     

     

    using (Device device = descriptor.OpenDevice())

    {

     

     

    //Console.WriteLine("\t\t Product: " + device.Product);

    listBox1.Items.Add(

    " Product: " + device.Product);

     

     

    //Console.WriteLine("\t\tManufacturer: " + device.Manufacturer);

    listBox1.Items.Add(

    " Manufacturer: " + device.Manufacturer);

     

     

    //Console.WriteLine();

    }

    }

     

     

    catch (UsbException ex)

    {

     

     

    //Console.WriteLine("Got Exception : " + ex);

    listBox1.Items.Add(

    "Exception: " + ex) ;

Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.