I have a snippet of code that is not working... It was outside of a for loop and worked when I addressed the labels and textboxes individually. Now (inside the for loop) it can't seem to "find" the labels or textboxes....
Error Message: Object reference not set to an instance of an object.
Any help diagnosing this would be greatly appreciated!
Error Message: Object reference not set to an instance of an object.
Code:
For i = New Int16 To m_Dataset.Tables("tblCorners").Rows.Count - 1
[COLOR=green]''LABEL ATTRIBUTES[/color]
Me.Controls("lblCorner" & i).Enabled = True
Me.Controls("lblCorner" & i).Visible = True
Me.Controls("lblCorner" & i).Text = m_Dataset.Tables("tblCorners").Rows(i)(0).ToString
[COLOR=green]'TEXTBOX ATTRIBUTES[/color]
Me.Controls("txtCorner" & i).Enabled = True
Me.Controls("txtCorner" & i).Visible = True
Me.Controls("txtCorner" & i).Text = FormatCurrency(m_Dataset.Tables("CornerNum" & i).Rows(0)(0), 2, TriState.False, TriState.False, TriState.True)
dblTemp += Me.Controls("txtCorner" & i).Text
Next
Any help diagnosing this would be greatly appreciated!