Problem cycling throught datepicker dynamic controls

sethindeed

Centurion
Joined
Dec 31, 1969
Messages
118
Location
Montreal Canada
...

Here is my code :

For Each ctl in GroupBox1.Controls
If Not TypeOf ctl Is Label Then
ctl.Text = OleReader (ctl.Name.ToString)
End If
Next

All controls update themselves except for the DateTime picker. The reason is simple, it does not have a Text property, it uses the Value property instead. I can't directly refer to the DateTime Picker in the code (i.e OpenTime.Value = "0:00:00 AM" ) because the control is loaded from a class at runtime.

Is there a way to assign to the ctl variable the datatime picker type of control, then cycle throught it. What was supposed to be a dynamic application turns out to be a complete headache.

thx
 
Nevermind
I solved my problem.
ctl will accept the Text property for a datepicker even if it is not in its collection.
One of .Net strong point, I have to admit ;)
 
Back
Top