Search for a particular UL Device by name in C++.NET

So you don't need to have your program hard coded to a particular board number in InstaCal, this program will search for the UL supported device name.

Though this example demonstrates finding a USB-QUAD08, you can substitute any UL supported product to find.

Note:  there are other versions of this app note for C# and VB.NET

Placed in:
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e)

//First Lets make sure there's a QUAD08 plugged in:
System::String ^ BoardName, ^ MyBoardName;
System::Int16 BoardNum;
System::Boolean Boardfound  = false;
for( BoardNum = 0;BoardNum < 99; BoardNum++)
 DaqBoard =gcnew  MccDaq::MccBoard(BoardNum);
 if (DaqBoard->BoardName->Contains("QUAD08"))
  Boardfound = true;
  this->Text = "USB-QUAD08 found as board number: " + BoardNum.ToString();
  ULStat = DaqBoard->FlashLED();

 if (Boardfound == false)
  System::Windows::Forms::MessageBox::Show("No compatible board found in system.  Please run InstaCal.", "No Board detected" );

 System::String ^ mystring = DaqBoard->BoardName->Substring(0, DaqBoard->BoardName->Trim()->Length - 1) +
  " found as board number: " + BoardNum.ToString();
 this->Text = mystring;

Disclaimer:  The attached code or example is provided 'As Is.'  It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments.  You assume all risks for use of the Code or Example.

Posted 2/15/2012 6:07:59 AM by Jeff