title: VB6 Can IsNumeric be wrong?
body: <p>Is it possible to test a string with IsNumeric() and for it to return true, but when you cast that same string to an integer using CInt() and assign it to a variable of type integer that it will give a type mismatch error?</p>
  
  <p>I ask because I was getting a type mismatch error, so I used IsNumeric() to check the string was numeric before trying to cast it, but I still get the error.</p>
  
  <p>I am tearing my hair out with this.</p>
  
  <p>Here is the code in question.
  <code>iGlobalMaxAlternatives = CInt(strMaxAlternatives)</code> is where the error is occuring.</p>
  
  <pre><code>Dim strMaxAlternatives As String
  Dim iGlobalMaxAlternatives As Integer
  iGlobalMaxAlternatives = 0
  bSurchargeIncInFare = True
  
  strMaxAlternatives = ReadStringKeyFromRegistry("Software\TL\Connection Strings\" &amp; sConn &amp; "\HH", "MaxAlt")
  
  If IsNumeric(strMaxAlternatives) And strMaxAlternatives &lt;&gt; "" Then
      iGlobalMaxAlternatives = CInt(strMaxAlternatives)
  End If
  </code></pre>