Private Sub Command2_Click(Index As Integer)
 
 Select Case Index
   
   Case 0
 If Not pointFlag Then
 If firstN Then
 strN1 = "0."
 firstN = False
 Else: strN1 = strN1 + "0."
 End If
 Else
 Exit Sub
 End If
 pointFlag = True
 Text1.Text = strN1
  
  Case 1
 If Sgn(Val(strN1)) = 1 Then
 strN1 = "-" + strN1
 Else
 If Sgn(Val(strN1)) = -1 Then
 strN1 = Right(strN1, Len(strN1) - 1)
 End If
 Text1.Text = strN1
  
  Case 2 To 5
 firstN = True
 pointFlag = False
If SignFlag Then
Call run
Else
SignFlag = True
strN2 = strtN1
strN1 = ""
End If
Runsign = idex - 1
End Select
 End Sub

解决方案 »

  1.   

    代码就没空帮你看了
    你可以把case块逐个注释掉
    用排除法肯定能找到问题
    有可能问题出在if……else块上
      

  2.   

    Case 1下页的代码少了一个end if
      

  3.   

    Case 1下少了个end if
      

  4.   

    写代码时要注意下格式,虽然VB6.0没有给我们提供自动缩进,但是用tab键也可以很方便的控制,这样代码看起来清晰。比如你的代码改成如下形式,一看就知道那里不对了。
    Private Sub Command2_Click(Index As Integer)
     
        Select Case Index
        Case 0
            If Not pointFlag Then
                If firstN Then
                    strN1 = "0."
                    firstN = False
                Else
                    strN1 = strN1 + "0."
                End If
            Else
                Exit Sub
            End If
            pointFlag = True
            Text1.Text = strN1
        Case 1
            If Sgn(Val(strN1)) = 1 Then
                strN1 = "-" + strN1
            Else
                If Sgn(Val(strN1)) = -1 Then
                    strN1 = Right(strN1, Len(strN1) - 1)
                End If
            Text1.Text = strN1
             
        Case 2 To 5
            firstN = True
            pointFlag = False
            If SignFlag Then
                Call run
            Else
                SignFlag = True
                strN2 = strtN1
                strN1 = ""
            End If
            Runsign = idex - 1
        End Select
    End Sub