R
Rich
Greetings all,
(apologize in advance if I am too VB6'd out). So I have a
list of controls on a vb.net windows form. 2 datetime
pickers, 2 checkboxes, 4 textboxes. In VB6 I could load
these guys up into a variant array and initialize them. I
understand in vb.net the variant went away for an object.
So I created an array of objects, but I can't initialize
the controls. How to do it? Here is what I have (kind of
pseudocode):
Dim arrObj As Object() = New arrobj() {dtp1, dtp2, chk1,
chk2, txt1, txt2, txt3, txt4}
Dim i As Integer
For i = 0 to arrObj.Length - 1
If i < 2 Then arrObj(i).Value = #3/1/2004#
If i > 1 and i < 4 Then arrObj(i).Checked = True
If i > 3 Then arrObj(i).Text = "test" & i
Next
Obviously, this won't even compile but it is what I would
like to do. Any suggestions appreciated how I could do
this.
Thanks,
Rich
(apologize in advance if I am too VB6'd out). So I have a
list of controls on a vb.net windows form. 2 datetime
pickers, 2 checkboxes, 4 textboxes. In VB6 I could load
these guys up into a variant array and initialize them. I
understand in vb.net the variant went away for an object.
So I created an array of objects, but I can't initialize
the controls. How to do it? Here is what I have (kind of
pseudocode):
Dim arrObj As Object() = New arrobj() {dtp1, dtp2, chk1,
chk2, txt1, txt2, txt3, txt4}
Dim i As Integer
For i = 0 to arrObj.Length - 1
If i < 2 Then arrObj(i).Value = #3/1/2004#
If i > 1 and i < 4 Then arrObj(i).Checked = True
If i > 3 Then arrObj(i).Text = "test" & i
Next
Obviously, this won't even compile but it is what I would
like to do. Any suggestions appreciated how I could do
this.
Thanks,
Rich