'how to elevate administrator pirivileges only when required vb.net

I want to make an application with self-update function.

Unfortunately, when I want to click on the button called "Update" it throws an error, with the message: "Access Denied!"

Here is the code I used:

Public Sub versionfileUPDATE()
    Try
        If System.IO.File.Exists(My.Settings.telepitesihely & "/seemtahelperv1downloader.exe") Then
            System.IO.File.Delete(My.Settings.telepitesihely & "/seemtahelperv1downloader.exe")
            Threading.Thread.Sleep(500)
            client.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/s/azz6qundbe2rna1/SeeMta%20PK%20Generator%20V1.exe?dl=11"), My.Settings.telepitesihely & "/seemtahelperv1downloader.exe")
        Else
            client.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/s/azz6qundbe2rna1/SeeMta%20PK%20Generator%20V1.exe?dl=1"), My.Settings.telepitesihely & "/seemtahelperv1downloader.exe")
        End If
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub

So, is there any solution to require administrator privilege, when the user clicks on the update button?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source