Note that there are some explanatory texts on larger screens.

plurals
  1. POsolve mismatch error for visual basic 6.0
    text
    copied!<p>When I run this code it show a dialog box that says 'Mismatch Type' at line <code>For i = 0 To UBound(arffArray)</code>. What is the problem with my code?</p> <pre><code>Public Function processFile() Dim i, j, posRelation, temp, att, data, flag Dim strRelation Dim strAtt Dim strData strRelation = "@relation" strAtt = "@attribute" strData = "@data" att = 0 data = 0 For i = 0 To UBound(arffArray) If (InStr(arffArray(i), strRelation)) Then temp = Replace(Mid(arffArray(i), 11, Len(arffArray(i))), "'", "") RelationName = temp ElseIf (InStr(arffArray(i), strAtt)) Then flag = parseAtt(att, arffArray(i)) If (Not flag) Then processFile = flag Exit Function End If att = att + 1 ElseIf (InStr(arffArray(i), strData)) Then data = readTheRest(i) i = UBound(arffArray) 'end the loop totalData = data End If Next 'get the list of class name Dim tmpClassAttr tmpClassAttr = attArray(1, UBound(attArray, 2)) For i = 0 To UBound(tmpClassAttr) ReDim Preserve classArray(i) classArray(i) = Trim(tmpClassAttr(i)) Next processFile = True End Function '------------------------------------------------------------ 'Function: parseAtt(num, attrData, ByVal m As MineKnow) 'require: ' &gt;@num -&gt; current attribute counter ' &gt;@attrData -&gt; current attribute declaration 'Raises: error if reading non numeric data/attribute 'Return: boolean parseAtt TRUE/FALSE, TRUE if parse successfully or otherwise 'Effect: parsing file content to: ' &gt; attributes '------------------------------------------------------------ Private Function parseAtt(num, attrData) Dim temp, i, j, strAtt, temp2, pos, atVal ReDim Preserve attArray(2, num) 'possible type of declarations '@attribute outlook {sunny, rainy, overcast} '@attribute outlook {sunny,rainy,overcast} 'attribute pos = 12 'get the attribute name first get the pos of "{" pos = InStr(1, attrData, "{", 1) If (pos = 0) Then error = "----&gt;Nominal attribute only." &amp; vbCrLf &amp; "----&gt;" &amp; attrData parseAtt = False Exit Function Else strAtt = Trim(Mid(attrData, 12, pos - 12)) atVal = Mid(attrData, pos + 1, Len(attrData) - (pos + 1)) atVal = Replace(atVal, "'", "") atVal = Replace(atVal, "''", "") atVal = Replace(atVal, "}", "") atVal = Replace(atVal, " ", "") temp = Split(atVal, ",") attArray(0, num) = strAtt attArray(1, num) = temp parseAtt = True End If End Function </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload