This constraint shouldn't be needed, since h will never exceed 0xFFFFF (since h0 and h1 are max 0xFF and h2 is max 0x0F):
Dim h As ULong = h0 * 0x1000 + h1 * 0x10 + h2
If h > 0x100000 Then
Humidity = 0x100000
End If
Also, why assign to Humidity when it is immediately overwritten anyway? :
If h > 0x100000 Then
Humidity = 0x100000
End If
Humidity = h / 0x100000 * 100 '%
Also, Humidity can never be exactly 100.0% since h will never be 0x100000 (never exceed 0xFFFFF). Not that it matters much, we're only talking about one part in a million, which I assume will be buried by sensor noise anyway. But for some use cases, exact correctness counts.