Board index » Visual Studio » propertyinfo.setvalue
|
CaliDave
|
propertyinfo.setvalue
Visual Studio203
This part is easy: Dim oControl As Control oControl = Me.Page.FindControl("TextBox1") Dim oPropertyInfo As PropertyInfo oPropertyInfo = oControl.GetType.GetProperty("Text") oPropertyInfo.SetValue(oControl, "Some New Text", Nothing) What about in the case when the property may have properties that need to be changed? For instance the Infragistics WebTextEdit control, I couldn't quickly find a vb control example, has a property named "ButtonsAppearance" which has a property named "CustomButtonToolTip". The following code produces a targetexception. oControl = Me.Page.FindControl("WebTextEdit1") Dim oPropertyInfo As PropertyInfo oPropertyInfo = oControl.GetType.GetProperty("ButtonsAppearance") oPropertyInfo = oPropertyInfo.PropertyType.GetProperty("CustomButtonTooltip") oPropertyInfo.SetValue(oControl, "Some New Text", Nothing) I don't believe oControl is the correct target here but am at a loss as to how to provide the correct target. Any suggestions? - |
