arrays - Will you please help me in my migration to VB.NET from VB 6.0? -
this question has answer here:
- control array in vb.net 3 answers
i read article control arrays of vb6 not present in vb.net , rather, became "collection" or something.... (http://visualbasic.about.com/od/usingvbnet/l/bldykctrlarraya.htm)
now, i'm planning learn vb.net , accept whole new language.
so, "few steps" me migrate, here code vb6:
private sub command1_click() = 0 9 command2(i).caption = next end sub private sub command2_click(index integer) label1.caption = label1.caption + index end sub
i wonder if program is? let's it's number pad program. i'll explain program does, @ least now...
as can see, have 12... controls? (i'm sorry, i'm still little bit new in terms of programming)... yeh, 12 of them... 11 buttons , 1 label. 1 button, command1, give captions of other 10 buttons command2(index). , when command2(index) pressed, label1's current caption concatenated command2(index)'s index... (it's calculator, let's skip now)
so, teach me version/translation of in vb.net? :) thanks!
just add 12 regular buttons onto form button1
- button12
then create list hold reference these:
private _buttonlist new list(of button)
add buttons list on form_load:
private sub form1_load(sender object, e eventargs) handles mybase.load _buttonlist.add(button1) _buttonlist.add(button2) _buttonlist.add(button3) 'etc. end sub
then can use list access buttons (zero based) index:
_buttonlist(4).text = "foo"
Comments
Post a Comment