|
-
Jan 8th, 2010, 03:02 PM
#1
Thread Starter
Lively Member
Create a system for notification of updated software
Hello,
I need to implement a notification system software for each new verson,
I am interested only inform the user of the presence of updates, not autoupdate software, how can I do?
-
Jan 8th, 2010, 03:55 PM
#2
Re: Create a system for notification of updated software
you could put a textfile on your website that contains the most recent version of your software. Then your app could check this textfile and compare the version to its own version, and notify the user of an update if its available.
lets say your website had a text file called latestversion.txt, then you could write code like this:
Code:
'SOME CONSTANTS AND VARIABLES
Const NEW_VERSION_AVAILABLE As Integer = 1
Dim NewestVersionString As String = ""
Dim NewsestVersion As Version = Nothing
'USE WEBCLIENT TO DOWNLOAD VERSION TEXT FROM WEB
Using WC As New Net.WebClient
NewestVersionString = WC.DownloadString("http://www.mysite.com/latestversion.txt")
End Using
'LOAD VERSION STRING INTO AN ACTUAL VERSION OBJECT
NewsestVersion = New Version(NewestVersionString)
'COMPARE VERSION OBJECT WITH VERSION OBJECT OF CURRENT RUNNING PROGRAM
If NewsestVersion.CompareTo(My.Application.Info.Version) = NEW_VERSION_AVAILABLE Then
MessageBox.Show("New version available")
End If
-
Jan 8th, 2010, 04:23 PM
#3
Thread Starter
Lively Member
Re: Create a system for notification of updated software
you are great, in my mind i have something like this...
i try to put this into a function into a class file but when i try to call the function from the class, it give me an error...
why?
-
Jan 8th, 2010, 04:24 PM
#4
Re: Create a system for notification of updated software
How could I possibly answer that when you don't explain what the error is you got, and which line of code causes it?
-
Jan 8th, 2010, 04:37 PM
#5
Thread Starter
Lively Member
Re: Create a system for notification of updated software
this is the line
vb Code:
NewsestVersion = New Version(NewestVersionString)
the error is "wrong format of the input string"
-
Jan 8th, 2010, 04:38 PM
#6
Thread Starter
Lively Member
Re: Create a system for notification of updated software
this is the line
vb Code:
NewsestVersion = New Version(NewestVersionString)
the error is "wrong format of the input string"
-
Jan 8th, 2010, 05:04 PM
#7
Re: Create a system for notification of updated software
you would get that error if the NewVersionString variable does not contain a valid version formatted string. The format of a version number in .NET is x.x.x.x where each x is a number.
So what exactly does the textfile you put on the website look like?
-
Jan 9th, 2010, 09:45 AM
#8
Thread Starter
Lively Member
Re: Create a system for notification of updated software
i change something in the code:
vb Code:
Dim versioneProgramma As String = "v1.0" Dim NewestVersionString As String = "" Dim NewsestVersion As String Dim wc As New Net.WebClient() NewestVersionString = wc.DownloadString("http://www.mywebsite.com/software_version.txt") 'LOAD VERSION STRING INTO AN ACTUAL VERSION OBJECT NewsestVersion = NewestVersionString.ToString MsgBox(NewsestVersion) 'COMPARE VERSION OBJECT WITH VERSION OBJECT OF CURRENT RUNNING PROGRAM If NewsestVersion.CompareTo(versioneProgramma) = 1 Then MsgBox("New version") Else MsgBox("Software update") End If
software_version.txt contains a string = "v2.0"
in
i try to see what string the program read and the string is made with some carachters different from "v2.0"
the string is: "ÝÞv"
what's wrong?
-
Jan 9th, 2010, 10:02 AM
#9
Re: Create a system for notification of updated software
So don't use v1.0, v2.0, use 1.0.0.0 and 2.0.0.0
-
Jan 9th, 2010, 11:46 AM
#10
Thread Starter
Lively Member
Re: Create a system for notification of updated software
but "NewsestVersion" is a string and so it should compare string with string and so "v1.0" with "2.0"
isn't it?
-
Jan 9th, 2010, 01:14 PM
#11
Re: Create a system for notification of updated software
No. You are not comparing strings, you are getting a string, converting it to a version object (which is in the format of x.x.x.x) and then comparing this version object with the version object of the actual running exe file. If you right click on an exe file in windows and check the files version, does it say "V2.0"? No it will say 2.0.0.0 if it is in fact verison 2.0. So you need to use the format windows/.net uses for version numbers.
-
Mar 11th, 2010, 03:30 PM
#12
Re: Create a system for notification of updated software
Sorry to bump this one.
I usually download the textfile and read the value (e.g. 2.0.0.0). Works fine all the time, but as curious as I am, I had to try this one. Unfortunately I'm also getting the error. Look at screenshot:

rule 49 states -according your example- : NewsestVersion = NewestVersionString.ToString
My testing code (partial) "crashes" on line 10 with the error above:
vb.net Code:
Dim nVersionString As String = "" Dim nVersion As Version = Nothing ' download file from the web Using wClient As New Net.WebClient wClient.Credentials = New Net.NetworkCredential(usern, passw) nVersionString = wClient.DownloadString(ftp_path & "/version.file") End Using nVersion = New Version(nVersionString)
-
Mar 11th, 2010, 04:38 PM
#13
Re: Create a system for notification of updated software
What is the value of nVersionString when the program errors on that line? You can set a break point on that line and hover over nVersionString to see its value.
The only reason you should get that error is if nVersionString is not in a valid format of a version number.
-
Mar 12th, 2010, 03:49 AM
#14
Re: Create a system for notification of updated software
Thanks for the info Kleinma, but it seems like I have found the problem which causes this issue. The problem seems to be within VS, but then I could be wrong.
When creating a text-file, with a value like 2.0.0.0, within VS it returns: 2.0.0.0 
After creating a new textfile without the use of VS (on desktop), it returns the proper string: 2.0.0.0
Seems that VS is doing some weird things after the build or is that normal behavior and I'm missing something.
Last edited by Radjesh Klauke; Mar 12th, 2010 at 03:52 AM.
-
Mar 12th, 2010, 11:09 AM
#15
Re: Create a system for notification of updated software
What text encoding are you using for your text file?
-
Mar 13th, 2010, 05:09 AM
#16
Re: Create a system for notification of updated software
Where can I find that in VS? Searched in the options btw.
Last edited by Radjesh Klauke; Mar 13th, 2010 at 05:17 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|