Categories: News

Detect Graphics Card Programmatically Using Visual Basic

Detect Graphics Card Name

Is it possible to detect the graphics card name from .Net code? Yes it is possible using WMI. But you need to reference the System.Management and import it.

Windows Management Instrumentation

WMI is a great library which contains the details about various components required for the system to operate. Hard Disk Drive related information, processor information, Network components and the list goes on. It is really easy to query the data if you know a little about the data how it is organized.

Using WMI to Get the Graphics Card Name

WMI can be used to query a lot of information about hardware and Operating systems related information. ManagementObjectSearcher can be used to query the data. It accepts two parameters. The first parameter is to tell which section to search called as scope. And the second parameter is the actual query almost similar to SQL query. Using the Get method of ManagementObjectSearcher will give the result set in a collection.

Source Code

Imports System.Management

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, _

ByVal e As System.EventArgs) Handles Button1.Click

MsgBox(GetGraphicsCardName())

End Sub

Private Function GetGraphicsCardName() As String

Dim GraphicsCardName = String.Empty

Try

Dim WmiSelect As New ManagementObjectSearcher _

(“rootCIMV2”, “SELECT * FROM Win32_VideoController”)

For Each WmiResults As ManagementObject In WmiSelect.Get()

GraphicsCardName = WmiResults.GetPropertyValue(“Name”).ToString

If (Not String.IsNullOrEmpty(GraphicsCardName)) Then

Exit For

End If

Next

Catch err As ManagementException

MessageBox.Show(err.Message)

End Try

Return GraphicsCardName

End Function

End Class

techfeatured

Recent Posts

The Benefits of Partnering with an IT-Managed Service Provider for Your Business

Table of Contents Introduction to IT Managed Service Providers Why Outsource IT Management? Cost-Effective Solutions…

2 months ago

Choosing the Right Thresholds for Your Home: A Comprehensive Guide

Key Takeaways: The importance of selecting the correct thresholds for different areas in your home…

4 months ago

Innovative Railing Gate Solutions for Modern Homes

Key Takeaways: The variety of railing gate designs can significantly enhance the aesthetic appeal of…

4 months ago

How To Choose the Perfect Vehicle for Extended Commutes

For many, commuting is an unavoidable part of daily life. But when that commute extends…

4 months ago

The Future of Mobility: Innovations in Automotive Technology

When you're on the road, you want to feel safe, comfortable, and like you have…

5 months ago

Clean Air Starts at Home: Tips for Maintaining Indoor Air Quality

Key Takeaways: Understanding the significance of indoor air quality. Identifying common pollutants in your home.…

5 months ago