Hello
I am trying to make my application autoupdatable from online. I tried it using ClickOnce. It is great but the thing is i dont want to check for the updates automatically, i want it from my code...
I tried like this,
Removed the check in the "Updates-> this applicaiton should check for the updates" and tried it frm my code which i found somewhere.
Imports
system
Imports
system.collections.generic
Imports
system.componentmodel
Imports
system.data
Imports
system.drawing
Imports
system.text
Imports
system.windows.forms
Imports
system.deployment.application
Imports
System.IO
Public
Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
DimWithEvents ad As ApplicationDeployment
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ad = ApplicationDeployment.CurrentDeployment
ad.CheckForUpdateAsync()
End Sub
Private Sub ad_UpdateCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) Handles ad.UpdateCompleted
Application.Restart()
End Sub
Private Sub ad_UpdateProgressChanged(ByVal sender As Object, ByVal e As DeploymentProgressChangedEventArgs) Handles ad.UpdateProgressChanged
Me.Progressbar1.value = e.progressPercentage
End Sub
Private Sub ad_CheckForUpdateCompleted(ByVal sender As Object, ByVal e As CheckForUpdateCompletedEventArgs) Handles ad.CheckForUpdateCompleted
If e.UpdateAvailable Then
If (MessageBox.Show("Updates Available for the Application." & vbNewLine & "Click OK to Continue", "New Updates", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) = Windows.Forms.DialogResult.OK) Then
ad.UpdateAsync()
End If
End If
End Sub
End
Class
but i am getting and error. its meaning is we can't do the above like
when i retried with the check on then only it is working
any solution????.