Ben
Ben

Reputation: 1032

How to compare numbers with 2 decimal places in VB.NET

I'm trying to compare Office version numbers in vb.NET

How can I determine if: 12.0.64 is greater or less than say 12.0.62 or 14.0.4762

It seems the fact that there is 2 decimals, vb doesn't like it.

Upvotes: 2

Views: 1852

Answers (1)

Cody Gray
Cody Gray

Reputation: 244722

Use the Version class, which is specifically designed to handle version numbers like the ones you're trying to compare.

It provides a CompareTo method that accepts another Version object to compare against, and returns a value indicating their relative values.

Upvotes: 8

Related Questions