I've spent the last two hours trying to figure this one out,but no luck.
Basicly it's pretty simple.When a button is clicked,my program gets the list of all Drives on a current computer.
Then I use String.Concat to merge the drive letter and the rest of the path.
So I get something like: "C:\" + "somefolder\somefile.some_extension"
That creates a full path to a file I am looking for.Then I check if that file exists.If it doesn't exist,I use Process.Start to run the setup file(to install the program I need).
It works well and installs the program I need.
The Problem:
I want my application,after the installation is finished,to check again if the program is installed and ofcourse confirm that it is.
This is my code:
Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim DriveList As String() = Directory.GetLogicalDrives() Dim Drive, FullPath, Path1 As String Dim EmptyDrives As Integer Path1 = "wamp\wampmanager.exe" EmptyDrives = 0 For Each Drive In DriveList FullPath = String.Concat(Drive, Path1) If File.Exists(FullPath) Then MsgBox("Wamp server is installed and can be found at: " & FullPath) Exit Sub Else EmptyDrives = EmptyDrives + 1 If Directory.GetLogicalDrives.Count = EmptyDrives Then Dim AppPath As String AppPath = My.Application.Info.DirectoryPath If MsgBox("We could not detect Wamp server on this machine!" & vbNewLine & "Would you like to install Wamp Server now?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Process.Start(AppPath & "\WampServer20h.exe") End If End If End If Next Drive End Sub




Reply With Quote