Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8124481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:28:18+00:00 2026-06-06T06:28:18+00:00

I’m writing an application in Visual Basic to tell the user about their PC.

  • 0

I’m writing an application in Visual Basic to tell the user about their PC.

All this is in a module:

Imports Microsoft.VisualBasic.Devices
Imports System.Management
Imports System.Net
Imports System.IO
Imports System.Windows.Forms
Imports System.Deployment.Application

Module ComputerSpecModule
    Public Enum infotypes
        ProcesserName
        VideocardName
        VideocardMem
    End Enum


    Public Function getinfo(ByVal infotype As infotypes) As String
        Dim info As New ComputerInfo : Dim value, vganame, vgamem, proc As String
        Dim searcher As New Management.ManagementObjectSearcher( _
            "root\CIMV2", "Select * FROM Win32_VideoController")
        Dim searcher1 As New Management.ManagementObjectSearcher( _
            "Select * FROM Win32_Processor")
        If infotype = infotypes.ProcesserName Then
            For Each queryObject As ManagementObject In searcher1.Get
                proc = queryObject.GetPropertyValue("Name").ToString
            Next
            value = proc
        ElseIf infotype = infotypes.VideocardName Then
            For Each queryObject As ManagementObject In searcher.Get
                vganame = queryObject.GetPropertyValue("Name").ToString
            Next
            value = vganame
        ElseIf infotype = infotypes.VideocardMem Then
            For Each queryObject As ManagementObject In searcher.Get
                vgamem = queryObject.GetPropertyValue("AdapterRAM").ToString
            Next
            value = Math.Round((((CDbl(Convert.ToDouble(Val(vgamem))) / 1024)) / 1024), 2) & " MB"
        End If
        Return value

    End Function

    Public oAddr As System.Net.IPAddress 'gets the ipv4 add
    Public sAddr As String


    Public EmailStarterMessage As String = "This message was sent by SpecMee. SpecMee is a light weight application designed to allow the users to find out the specifications of their machines. Please download this application free at http://www.wilson18.com/projects/SpecMee/" + _
    Environment.NewLine + _
    "" + _
    Environment.NewLine + _
    "" + _
    Environment.NewLine + _
    ""


    'PC SPEC CONTENT
    Public ComputerName As String = (My.Computer.Name.ToString)
    Public myOS As String = (My.Computer.Info.OSFullName)
    Public Processor As String = (getinfo(infotypes.ProcesserName))
    Public HDD As String = (Format((My.Computer.FileSystem.Drives.Item(0).TotalSize.ToString / 1024) / 1024 / 1024, "###,###,##0 GB"))
    Public RAM As String = (Format((My.Computer.Info.TotalPhysicalMemory / 1024) / 1024 / 1024, "###,###,##0 GB"))
    Public VideoCard As String = (getinfo(infotypes.VideocardName))
    Public VideoCardMemory As String = (getinfo(infotypes.VideocardMem))
    Public Function Resolution() As String
        Dim intx As Integer = Screen.PrimaryScreen.Bounds.Width
        Dim inty As Integer = Screen.PrimaryScreen.Bounds.Height
        Return intx & " x " & inty
    End Function
    Public Function InternalIPAddress()
        With System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName())
            oAddr = New System.Net.IPAddress(.AddressList(0).Address)
            InternalIPAddress = oAddr.ToString
        End With
    End Function
    Public Function ExternalIPAddress() As String
        Dim uri_val As New Uri("http://www.wilson18.com/projects/SpecMee/curip.php")
        Dim request As HttpWebRequest = HttpWebRequest.Create(uri_val)

        request.Method = WebRequestMethods.Http.Get
        Dim response As HttpWebResponse = request.GetResponse()
        Dim reader As New StreamReader(response.GetResponseStream())
        Dim myip As String = reader.ReadToEnd()
        response.Close()
        Return myip
    End Function



    Public EmailContent As String = ("Computer Name: " & ComputerName & Environment.NewLine & "Operating System: " & myOS & Environment.NewLine & "Processor: " & Processor & Environment.NewLine & "Hard Drive Size : " & HDD & Environment.NewLine & "RAM: " & RAM & Environment.NewLine & "Graphics Card: " & VideoCard & Environment.NewLine & "Graphics Onboard Memory: " & VideoCardMemory & Environment.NewLine & "Resolution: " & Resolution() & Environment.NewLine & "Internal IP Address: " & InternalIPAddress() & Environment.NewLine & "External IP Address: " & ExternalIPAddress() & Environment.NewLine)


End Module

The problem I am having is that if one of the things in the module fails, such as if the user’s graphics card does not have any onboard memory, then it will fail. This is causing everything else to fail as well.

I am very new to Visual Basic, so please excuse me if I have made any stupidly obvious errors, and any suggestions are welcome.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:28:19+00:00Added an answer on June 6, 2026 at 6:28 am

    Place the parts that can fail in a Try-Catch-statement

    Public VideoCardMemory As String = getinfo(infotypes.VideocardMem)
    
    Public Function getinfo(ByVal infotype As infotypes) As String        
        Try
            ...
            value = ...
            ...
        Catch
            value = "Cannot be accessed!"
        End Try
        Return value
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.