1

I want to compare the product version 1.9 to 1.10 but I am unable to do so as 1.9 is considered as 1.90.

Sumit Shitole
  • 110
  • 1
  • 3
  • 20
  • 1
    The problem is not specific to 2 decimals, what about vs 1.19 vs v1.192? Your best option is probably to create a new Version class implementing IComparable and handling the comparison logic – vc 74 Sep 25 '20 at 16:16
  • 5
    Yup - basically if the value isn't really "a single decimal number" but "a dot-separated sequence of integers" that's how you should parse it. – Jon Skeet Sep 25 '20 at 16:19

1 Answers1

6

Use the Version Class

    Dim ver1 As New Version("1.9")
    Dim ver2 As New Version("1.10")
    If ver1 = ver2 Then
        Stop
    ElseIf ver1 < ver2 Then
        Stop
    ElseIf ver1 > ver2 Then
        Stop
    End If
dbasnett
  • 11,334
  • 2
  • 25
  • 33