-
Accessing Progmaticly Defined Controls Properties
Hello. I've created a user control with two 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks