Hi All
Im new to this forum and new to VB.NET coming from VB6. I have a problem with a dynamic array and am unsure why i get the error "Object reference not set to an instance of an object."
im trying to add the text of a textbox to the array, i have also noticed that when i initilise the array with elements instead of keeping it dynamic it works.
Anybody have any ideas???
Thank you experts
My code is as follows
Im new to this forum and new to VB.NET coming from VB6. I have a problem with a dynamic array and am unsure why i get the error "Object reference not set to an instance of an object."
im trying to add the text of a textbox to the array, i have also noticed that when i initilise the array with elements instead of keeping it dynamic it works.
Anybody have any ideas???
Thank you experts
My code is as follows
Code:
Dim ctrl As Control, lbl As Control
Dim iCtrl, i As Integer
Dim strSizeArray() As String
For iCtrl = 0 To Panel1.Controls.Count - 1
ctrl = Panel1.Controls(iCtrl)
If ctrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
strSizeArray(iCtrl) = (CType(ctrl, TextBox).Text)
End If
Next