How do you compare app version numbers?
For instance each time my app starts I check a pref file to see if a new version is now being run in case any database or other files need updating.
So using the typical “a.b.c” version number scheme would you use a bunch of “if” statements, use some method convert into a representative double/integer or some other method?
If you’re using Kaju, there is a function in the module for that.
Otherwise, a*1000000 + b*1000 + c will give you an integer you can use.
I do transform the uncomparable string in a comparable string with:
Public Function ComparableVersionCode(verCode As String) as String
Dim verCodes() As String = verCode.Split(".")
Do Until verCodes.Ubound>2
verCodes.Append "0" // grow until 4 numbers "version.release.bug.build"
Do Until verCodes.Ubound<4
verCodes.Remove verCodes.Ubound // trim extra dot things until we get 4 numbers
For i As Integer = 0 to 3
verCodes(i) = Right("000000"+Str(verCodes(i).CLong),6)
Return Join(verCodes, ".")
thanks for the suggestions…
If you’re talking about notifying a customer of an update. I don’t compare version numbers of the application, instead I compare the app.executable.creationDate.
If you’re talking about a version format of a file, I’d recommend using a single integer in the file (at least a UInt16).