I am working on asp.net application where i have to find a control inside a form panel which is also inside another panel. For this i used the following code:-
Dim lbl As New Label
Dim st As String
st = "lblFeeder" + i.ToString()
lbl = CType(Me.Controls(st), Label)
lbl.Text = dt.Rows(37)("AnaTagValue")
But when the program runs it gives a error
"Object reference not set to an instance of an object."
at the postion
"lbl.Text = dt.Rows(37)("AnaTagValue")"
When i debug it i Found "Nothing" at the position
"lbl = CType(Me.Controls(st), Label)"
Actually the variable "st" will contain some string which will be equal to the control id in the form.
I want to find that control and assign the appropriate analog value to the control.