Link to home
Start Free TrialLog in
Avatar of ljpitre
ljpitre

asked on

How Determine Visual Basic Runtime version and build

How do I retrieve what the installed Visual Basic runtime version and build is?  I want to be able to display this information in a system information form.
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

This is how I did it :


Dim fso As New FileSystemObject
Private Sub Form_Load()
Dim sysfol As String
sysvol = fso.GetSpecialFolder(1)



'Get the folder object associated with the directory
Dim objFolder
Set objFolder = fso.GetFolder(sysvol & "\")

MsgBox objFolder
'Loop through the Files collection
Dim objFile
For Each objFile In objFolder.Files
  If Left(objFile.Name, 4) = "msvb" Then
  MsgBox "File exists"
  MsgBox objFile.Name
  MsgBox fso.GetFileVersion(sysvol & "\" & objFile.Name)
  Else
 'MsgBox "you goofed it"
  End If
Next

'Clean up!
Set objFolder = Nothing
Set objFile = Nothing
Set fso = Nothing
End Sub


You have to go to project --> references

and check microsoft scripting runtime
ASKER CERTIFIED SOLUTION
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just one mistake in the above one , change this :

MsgBox fso.GetFileVersion(sysvol & "\" & objFile.Name)

To this :

MsgBox fso.GetFileVersion(objFolder & objFile.Name)
Isn't that a "Catch 22"...   you're using a Visual Basic application to test for a required component of a Visual Basic application !  
Isnt there a better way of doing it ? I guess you could always do a vbscript to do it that way you arent using a vb app to check for vb runtime info. But since you want it inside of your form I did it using a vb app.

Not really sure how to get around that.