Mod level array of textboxes not loading?

G

Guest

Hello,

I need to load the following array in the Form_Load event in the same
fashion as here (without having to loop). What is the syntaxt for doing this
where I declare the array on the Module level but load it in Form_Load?
--------------------------------------------------------------------------------------------
Dim arrTxt As TextBox() = {txt0, txt1, txt2, txt3, txt4, txt5, txt6, txt7,
txt8, txt9, _
txt10, txt11, txt12, txt13, txt14}
--------------------------------------------------------------------------------------------
---here is what I want to do -- how to do this?
Dim arrTxt As TextBox()
Private Sub Form1_Load(...) Handles MyBase.Load
'pseudocode -- does not work
arrTxt = TextBox(){txt0, txt1, txt2, txt3, txt4, txt5, txt6, txt7, txt8,
txt9, _
txt10, txt11, txt12, txt13, txt14}

End Sub


Thanks,
Rich
 
G

Guest

I figured it out

Dim arrTxt As TextBox()
Private Sub Form1_Load(...) Handles MyBase.Load
'pseudocode -- does not work
arrTxt = New TextBox(){txt0, txt1, txt2, txt3, txt4, txt5, txt6, txt7,
txt8, _
txt9, txt10, txt11, txt12, txt13, txt14}


---I forgot to put the "New" keyword in front of Textbox()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top