Re: Problem Comparing program Versions
- From: "Jim Mack" <jmack@xxxxxxxxxxxxxxx>
- Date: Sat, 13 Dec 2008 23:24:03 -0500
Norm wrote:
Hi,
I am probably missing something simple, but I have been having a
problem trying to figure out the best way to compare versions of a
program for updating.
I thought I could just add the Major, Minor and Revision, but it
would be possible for 4.2.2 to be more than 5.1.1. The same holds
true if I just check each number.
No, if you check each number in sequence from major on down, you will
never fail. 5 is > 4, so you stop comparison right there. You'd only
test the second values if the first ones were equal.
You could add up the parts, but only if you weight them first. (Major
* 1000000) + (Minor * 10000) + (Revision * 100) + Build -- or whatever
the parts are called (a 'correct' version number has 4 parts -- VB
unaccountably leaves one out).
Choose appropriate weights based on the maximum values you could
encounter. The ones I show would work for most apps, but probably not
for all.
--
Jim Mack
MicroDexterity Inc
www.microdexterity.com
.
- Follow-Ups:
- Re: Problem Comparing program Versions
- From: Larry Serflaten
- Re: Problem Comparing program Versions
- References:
- Problem Comparing program Versions
- From: Norm
- Problem Comparing program Versions
- Prev by Date: Re: How to resolve new "Unable to find file" error with a DLL
- Next by Date: Re: Problem Comparing program Versions
- Previous by thread: Re: Problem Comparing program Versions
- Next by thread: Re: Problem Comparing program Versions
- Index(es):
Relevant Pages
|