Measurement Computing   Easy to Use | Easy to Integrate | Easy to Support catalog banner

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

Expand / Collapse
 

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();
  break;
 }
}

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

 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.



Rate this Article:

Add Your Comments


For comments email TechSupport@mccdaq.com.

Details
Article ID: 50311

Last Modified:2/16/2012 8:49:50 AM

Article has been viewed 2,088 times.

Options