Wednesday, October 29, 2008

Introduction to Progressbar control(VB)

Add Timer and progressbar on you form.
Name the progressbar myProg
'Within the form load

myProg.Mininmum=0
myProg.Maximum=100

'Double click Timer control on the form and add this code

MyProg.Value=MyProg.Value+myProg.Step
if(MyProg.Value>100)
(
'Reset the value of
myProg.Value=0
)


Add additional code to Timer control and you shoul be ok.

TALEY A OURO

Introduction to ClickOnce API

Prerequisites: Visual Studio 2005/2008;VB.NET ;C#
1-Imports System.Deployment.Application
2-Got to Properties of your application/Publish tab/Unchek Application should check for Update
3-Make sur you set Update location (very important)







VB.NET

Private Sub InstallUpdateSyncWithInfo()

Dim info As UpdateCheckInfo = Nothing
If (ApplicationDeployment.IsNetworkDeployed) Then
Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
Try
info = AD.CheckForDetailedUpdate()
Catch dde As DeploymentDownloadException
MessageBox.Show("The new version of the application cannot be downloaded at this time. " + ControlChars.Lf + ControlChars.Lf + "Please check your network connection, or try again later. Error: " + dde.Message)
Return
Catch ioe As InvalidOperationException
MessageBox.Show("This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message)
Return
End Try
If (info.UpdateAvailable) Then
Dim doUpdate As Boolean = True
If (Not info.IsUpdateRequired) Then
Dim dr As DialogResult = MessageBox.Show("An update is available. Would you like to update the application now?", "Update Available", MessageBoxButtons.OKCancel)
If (Not System.Windows.Forms.DialogResult.OK = dr) Then
doUpdate = False
End If
End If
If (doUpdate) Then
Try
AD.Update()
MessageBox.Show("The application has been upgraded, and will now restart.")
Application.Restart()
Catch dde As DeploymentDownloadException
MessageBox.Show("Cannot install the latest version of the application. " + ControlChars.Lf + ControlChars.Lf + "Please check your network connection, or try again later.")
Return
End Try
End If
End If
End If
End Sub


C#





private void InstallUpdateSyncWithInfo()
{
UpdateCheckInfo info = null;
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
try
{
info = ad.CheckForDetailedUpdate();
}
catch (DeploymentDownloadException dde)
{
MessageBox.Show("The new version of the application cannot be downloaded at this time. \n\nPlease check your network connection, or try again later. Error: " + dde.Message);
return;
}
catch (InvalidDeploymentException ide)
{
MessageBox.Show("Cannot check for a new version of the application. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message);
return;
}
catch (InvalidOperationException ioe)
{
MessageBox.Show("This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message);
return;
}
if (info.UpdateAvailable)
{
Boolean doUpdate = true;
if (!info.IsUpdateRequired)
{
DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?", "Update Available", MessageBoxButtons.OKCancel);
if (!(DialogResult.OK == dr))
{
doUpdate = false;
}
}
if (doUpdate)
{
try
{
ad.Update();
MessageBox.Show("The application has been upgraded, and will now restart.");
Application.Restart();
}
catch (DeploymentDownloadException dde)
{
MessageBox.Show("Cannot install the latest version of the application. \n\nPlease check your network connection, or try again later. Error: " + dde);
return;
}
}
}
}
}



If you have any question or concern send me email



TALLEY A.OURO



Software Archictect

Introduction to ClickOnce Deployment

About Me

My photo
Raleigh, NC, United States
I am a software developer based in Raleigh,NC,USA.I design softwares and systems ;i also do consulting for companies worldwide.I program with these languages:VB.NET 2003/2005/2008;C#;Java(fun),SQL(200,2005,2008);ASP.NET 2.0/3.5;ASP.NET AJAX;ASP.NET MVC;JavaScript;JQuery;Windows Workflow Foundation;Web Services.I have 4 years + in programming.