0

I am trying to update the text property of multiple labels on my page that I know exist by the naming convention I have below. However when I try to access them in this way I always get an "Input String was not in correct format" error.

 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

1 Answers1

0

I guess in your line 3 it should be:

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

I don't know if this causes the problem you described

Stefano Losi
  • 719
  • 7
  • 18