vb.net 2005 Visual Studio Array help
Posted on 2006-10-29
I am having difficulty with my array declaration in my application. One form has my DataGridView on it. It has
a button to generate a report. The form that is loaded from the button click has the Crystal Viewer on it. So to start,
in the generate button I can load the data from my DataGridView into the arrays using this code:
Records = DataGridView.RowCount
Dim ParmArray(Records - 1) As String
Dim ParmValue(Records - 1) As String
Dim i As Integer
For i = 0 To Records - 1
ParmArray(i) = DataGridView.Rows(i).Cells(1).Value.ToString
ParmValue(i) = DataGridView.Rows(i).Cells(2).Value.ToString
In order to share the the Arrays with the second form with the Crystal Viewer so I can build the parameter
list to pass to the report, I put the Array declarations in the Globals module. When I do that,
the Arrays do not get assigned the RecordCount - 1 value to dimension the array.
It seems like a pretty straight-forward idea...share arrays between forms. Is it not possible to do it this way?