C++/CLI ManagmentObjectSearcher using

Wami007 296 Reputation points
2021-02-13T17:18:31.143+00:00

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
ManagementObjectSearcher^ searcher = gcnew ManagementObjectSearcher("select*from Win32_BIOS ");
lb1->Text = Convert::ToString(searcher);
}

Hello,

I wanna Define Hardware info to my Label, but it shows me " System.Managment.Object.Searcher ". Can Anyone help me for it, with correct sample code :(

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,922 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,728 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,160 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 117.3K Reputation points
    2021-02-13T18:13:39.707+00:00

    For example, if you want to display the manufacturer and serial number, then:

    ManagementObjectSearcher searcher( "select * from Win32_BIOS" );
    for each( ManagementObject ^ d in searcher.Get( ) )
    {
         lb1->Text = d["Manufacturer"]->ToString( );
         lb2->Text = d["SerialNumber"]->ToString( );
    
         break;
    }
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.