我正在尝试通过下面的命名约定更新我知道存在的页面上多个标签的文本属性。但是,当我尝试以这种方式访问它们时,我总是会收到“输入字符串格式不正确”的错误。
For i = 1 To 5
Dim title As Label = CType(Me.Controls("title" & i), Label)
title.Text = alist(i * section).inDate
Dim postDate As Label = CType(Me.Controls("postDate" & i), Label)
postDate.Text = alist(i * section).inDate
Dim depart As Label = CType(Me.Controls("depart" & i), Label)
depart.Text = alist(i * section).department
Dim mess As Label = CType(Me.Controls("mess" & i), Label)
mess.Text = alist(i * section).message
Next