Dim x = UBound(TxnTaskChangeArray) ReDim Preserve TxnTaskChangeArray(DataGridView1.Rows.Count + x, 3) For i = 1 To DataGridView1.Rows.Count For j = 1 To DataGridView1.Columns.Count TxnTaskChangeArray((i + x) - 1, j - 1) = DataGridView1.Item(j - 1, i - 1).Value Next Next ReDim Preserve TxnTaskChangeArray(DataGridView1.Rows.Count + x, 3) 'display array data in another grid after save DataGridView3.Rows.Clear() DataGridView3.RowCount = UBound(TxnTaskChangeArray) DataGridView3.ColumnCount = 3 For i = 1 To DataGridView3.Rows.Count For j = 1 To DataGridView3.Columns.Count DataGridView3.Item(j - 1, i - 1).Value = TxnTaskChangeArray(i - 1, j - 1) Next Next
so somewhere in my app i declared the TxnTaskChangeArray as:
Public TxnTaskChangeArray(0,3) as String
This is what the array is set to when I open the app... I then have a datagrid with 3 columns to which I add several rows... I add data to those rows and press a button to call the above procedure... x then = the number of rows in the array already (which on 1st run will be 0) and then adds the new rows... the second datagrid (or datagridview3 in the above code) shows the total array every time i update it...
My problem is that if i keep the code the way it is, i will get an error that says (you can only resize the right most dimension of the array)... I'm not changing it though... its always staying as 3.. If I take out the piece of code that says redim (the first instance of it) and leave the redim at the end of the procedure, every row above the most current update is taken out..
heeeeeelp! thanks as always