0

我正在尝试通过下面的命名约定更新我知道存在的页面上多个标签的文本属性。但是,当我尝试以这种方式访问​​它们时,我总是会收到“输入字符串格式不正确”的错误。

 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
4

1 回答 1

0

我想在你的第 3 行应该是:

title.Text = alist(i * section).title

我不知道这是否会导致您描述的问题

于 2017-07-08T12:55:40.197 回答