Hello,
I am having a small problem with the correct syntax to achieve my goal.
I am creating an application that needs to create controls dynamicaly from a hashtable, I have created a #table that conatins key and value pairs with the key being the control parameter and the value being the desired parameter value.
I am then creating a new instance of a control using the following code:
newControl = CType(Activator.CreateInstance(t), Control)
To populate the new controls parameters from a hash table I can use something like:
newControl.Left = ctrl.Item("Left")
But what I would like to be able to do is use the #tables key value as the parameter name(in red above) and and use a loop to build the control parameters, something like this:
Dim en As IDictionaryEnumerator = ctrl.GetEnumerator
While en.MoveNext
newControl.(ctrl.key) = ctrl.value
End While
I am unsure as to the correct syntax to achieve this if it is possible, it is probably me being daft.
I look forward to any sage advice that can be given
Many Thanks
Frootmig...
I am having a small problem with the correct syntax to achieve my goal.
I am creating an application that needs to create controls dynamicaly from a hashtable, I have created a #table that conatins key and value pairs with the key being the control parameter and the value being the desired parameter value.
I am then creating a new instance of a control using the following code:
newControl = CType(Activator.CreateInstance(t), Control)
To populate the new controls parameters from a hash table I can use something like:
newControl.Left = ctrl.Item("Left")
But what I would like to be able to do is use the #tables key value as the parameter name(in red above) and and use a loop to build the control parameters, something like this:
Dim en As IDictionaryEnumerator = ctrl.GetEnumerator
While en.MoveNext
newControl.(ctrl.key) = ctrl.value
End While
I am unsure as to the correct syntax to achieve this if it is possible, it is probably me being daft.
I look forward to any sage advice that can be given
Many Thanks
Frootmig...