VB6预计声明结束

时间:2013-12-03 15:48:49

标签: vb6

我无法弄清楚我做错了什么。我不断收到'显示输出'下的错误“预期:结束语句”。评价。

Option Explicit

Private Sub cmdOkay_click()
    'Declare counter variable (p)
        Dim p As Integer
        p = 8

    'Declare variable to hold calculated minutes
        Dim minutes As Integer

    'Display title of chart in listbox
        MyListBox.AddItem “Cooking Chart”

    'For each pound (from 8 to 23), calculate and display minutes

        For p = 8 To 23
           'Calculate minutes.pounds * 17
            minutes = p * 17

    'Display output.
        MyListBox.AddItem p & “ lbs, “ & minutes & “ minutes.” ERROR
    Next p

End Sub

Private Sub cmdExit_Click()
    End
End Sub

1 个答案:

答案 0 :(得分:3)

由于双引号,您的代码未运行。我改变它们并且没有错误地运行

复制并粘贴此代码:

    'Declare counter variable (p)
    Dim p As Integer
    p = 8

'Declare variable to hold calculated minutes
    Dim minutes As Integer

'Display title of chart in listbox
    MyListBox.AddItem "Cooking Chart"


'For each pound (from 8 to 23), calculate and display minutes

    For p = 8 To 23
       'Calculate minutes.pounds * 17
        minutes = p * 17

       'Display output.
        MyListBox.AddItem p & " lbs, " & minutes & " minutes."
    Next p