I've stumbled upon one of those mysterious coding bugs that drives all of us crazy. I was removing some code in Form A, adding some new code in Form B and Class A, and when I try to compile my project, I'm getting an error in a BAS file that I haven't touched in weeks. I use the following function to help me find information in the registry, and I don't see why any of my changes should've caused the compiler to blow up in an unrelated BAS module.
VB Code:
  1. Private Function Query_ValueEx(ByVal lhKey As Long, ByVal szValueName As String, vValue As Variant) As Long
  2.     On Error GoTo QueryValueExError
  3.    
  4.     Dim cch             As Long
  5.     Dim lrc             As Long
  6.     Dim lType           As Long
  7.     Dim lValue          As Long
  8.     Dim sValue          As String
  9.    
  10.     lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch)
  11.     If lrc <> m_ERROR_NONE Then Error 5
  12.     Select Case lType
  13.         Case m_REG_SZ:
  14.         sValue = String(cch, 0)
  15.         lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, sValue, cch)
  16.         If lrc = m_ERROR_NONE Then
  17.             vValue = Left$(sValue, cch) '<--- ERROR HERE
  18.         Else
  19.             vValue = Empty
  20.         End If
  21.     Case m_REG_DWORD:
  22.         lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, lValue, cch)
  23.         If lrc = m_ERROR_NONE Then vValue = lValue
  24.     Case Else
  25.         lrc = -1
  26.     End Select
  27.    
  28. QueryValueExExit:
  29.     Query_ValueEx = lrc
  30.     Exit Function
  31.    
  32. QueryValueExError:
  33.     Resume QueryValueExExit
  34. End Function
Compile Error: Type-declaration character does not match declared data type. Any ideas?