How do I connect these two methods to create a simple program where I can drag and drop a program on my desktop or where ever onto my program and it will get the uninstall path and begin the uninstallation process.
So I know how to enable drag and drop
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.AllowDrop = True
End Sub
Private Sub Form2_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
For Each path In files
MsgBox(path)
Next
End Sub
Private Sub Form2_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
And I also know how to get the uninstallation path for a program
Dim DestKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Registry.LocalMachine.OpenSubKey(DestKey).GetSubKeyNames
UnInstallPath = Registry.LocalMachine.OpenSubKey(DestKey & App & "\").GetValue("UninstallString")
And finally how to uninstall the software
Dim p As New Process
p.StartInfo.FileName = "msiexec.exe"
p.Start()
My question is how do I connect all this to acheive what I want. I cant seem to figure out how I connect the drag and drop to the uninstall process