Accessing Progmaticly Defined Controls Properties
Public Property sConnStr() as string
Public Property PicNum() as integer
On a page I'm trying to load the control progmaticly then define those properties. This is what I've come up with after reading a few articles:
Sub DispPic()
Dim dispPicC as UserControl = LoadControl("pic_disp.ascx")
Dim dispPicCType as Type = dispPicC.GetType()
Dim dispPicPicNum as PropertyInfo = dispPicCType.GetProperty("PicNum")
dispPicPicNum.SetValue(dispPicC, PicNum, Nothing)
Dim dispPicsConnStr as PropertyInfo = dispPicCType.GetProperty("sConnStr")
dispPicsConnStr.SetValue(dispPicC, sConnStr, Nothing)
pic_disp.Controls.Add(dispPicC)
End Sub
I recieve the error Cannot widen from target type to primitive type. On the line that sets the value of dispPicPicNum.

