第一次张贴海报,找不到我需要的答案。我什至不知道此代码是否有效,因为在尝试将我的信息输出到列表框时,它一直给我“找不到数据成员”。
Dim ClassYoga(5) As Integer
Dim NumOfAttend As Integer
Dim index As Integer
'initialize array
index = 0
Do Until index > 4
ClassYoga(index) = 0
index = index + 1
Loop
'first input from user
NumOfAttend = InputBox("How many people will be attending class? (555 to quit")
Do Until NumOfAttend = 555
ClassYoga(NumOfAttend - 1) = ClassYoga(NumOfAttend - 1) + 1
NumOfAttend = InputBox("How many people will be attending class? (555 to quit")
Loop
'display
index = 0
lstYoga.RowSource = vbNullString
Do Until index > 4
lstYoga.AddItem ((index + 1) & "Attendants :" * ClassYoga(index))
Loop
它总是在.rowsource和.additem函数上返回错误。如果有人能告诉我该如何解决并输出结果,将不胜感激!
答案 0 :(得分:0)
在最后一个do循环中,您不增加索引