我尝试将每个时间段按钮的文本放入不同的日期数组中以表示不同日期的不同插槽,但是当我在主要子部分中调用它时,我继续在下面的代码中出现此错误 - &# 34; 对象引用未设置为对象的实例"。
Sub TimeDayArray()
Dim monday() As DateTime
Dim tuesday() As DateTime
Dim wednesday() As DateTime
Dim thursday() As DateTime
Dim friday() As DateTime
'80 is the total number of timeslots Per week week
For iMonday = 1 To 17
monday(iMonday) = CType(Controls("Button" & iMonday), Button).Text
'** reference not set to an instance of an object**
Next
For iTuesday = 17 To 32
tuesday(iTuesday) = CType(Controls("Button" & iTuesday), Button).Text
Next
For iWednesday = 33 To 48
wednesday(iWednesday) = CType(Controls("Button" & iWednesday), Button).Text
Next
For iThursday = 49 To 64
thursday(iThursday) = CType(Controls("Button" & iThursday), Button).Text
Next
For iFriday = 64 To 79
friday(iFriday) = CType(Controls("Button" & iFriday), Button).Text
Next
End Sub
非常感谢任何帮助。谢谢!