I have 50 text boxes on my tab page(tab1) named tbx1, tbx2 etc...
I am trying to populate these text boxes with data from a datatable
For i as integer = 0 To dt.Rows.Count - 1
tab1.Controls("tbx" & (i + 1).ToString).Text = dt.Rows(i).Item("VALUES").ToString
next
I also tried
For i as integer = 0 To dt.Rows.Count - 1
Dim txt As TextBox
Dim name As String = "tbx" & (i + 1).ToString
txt = tab1.Controls.Item(name)
txt.Text = dt.Rows(i).Item("VALUES").ToString
next
I get the same error on both: Object Reference not set to an instance of an object
Any help will be greatly appreciated.
I am trying to populate these text boxes with data from a datatable
For i as integer = 0 To dt.Rows.Count - 1
tab1.Controls("tbx" & (i + 1).ToString).Text = dt.Rows(i).Item("VALUES").ToString
next
I also tried
For i as integer = 0 To dt.Rows.Count - 1
Dim txt As TextBox
Dim name As String = "tbx" & (i + 1).ToString
txt = tab1.Controls.Item(name)
txt.Text = dt.Rows(i).Item("VALUES").ToString
next
I get the same error on both: Object Reference not set to an instance of an object
Any help will be greatly appreciated.