Ok. I have an unfixed-length array of textboxes that I created globally:
In one function, I used ReDim on the array to fix the length according to a local integer:
In another function, I need to get the values of the textboxes. Here's what I tried:
There seems to be a problem with "CF_string = CF_array(anInt).Text". I get the following error:
"System.NullReferenceException: Object reference not set to an instance of an object."
My guess is that when I ReDim and fill the array in the first function, it's not updating the global variable. So in the second function where I try to get values out of the global array, it's still empty. Any ideas? I think I'm on hour# 4 or 5 of trying to figure this out! Thanks in advance.
VB.NET:
Dim CF_array() As TextBox
In one function, I used ReDim on the array to fix the length according to a local integer:
VB.NET:
Public Function function1()
Dim someInt As Integer
someInt = 4
ReDim CF_array(someInt)
'Then fill the array with textboxes and display on web form with Dynamic Controls
End Function
In another function, I need to get the values of the textboxes. Here's what I tried:
VB.NET:
Public Function function2()
Dim CF_string As String
Dim anInt As Integer
anInt = 0
CF_string = CF_array(anInt).Text
End Function
There seems to be a problem with "CF_string = CF_array(anInt).Text". I get the following error:
"System.NullReferenceException: Object reference not set to an instance of an object."
My guess is that when I ReDim and fill the array in the first function, it's not updating the global variable. So in the second function where I try to get values out of the global array, it's still empty. Any ideas? I think I'm on hour# 4 or 5 of trying to figure this out! Thanks in advance.