Hey Folks,
I have an Unbound DataGridView that will display roughly 700 columns and 50 rows of unbound data (it gets calculated by the code and is not a lookup from a database of some sort). Right now, I create each DataGridCol in an array and use AddRange to add the Columns. Then I populate the Row data using DGV.Rows.Add(RowData) where RowData is an array of strings. The entire grid contents are actually coming from a 2D array of strings. This is functional, but if I wanted to load the data as quickly as possible into the DGV, how would you experts recommend going about it?
Thanks in advance
Hume
Code Excerpt:
I have an Unbound DataGridView that will display roughly 700 columns and 50 rows of unbound data (it gets calculated by the code and is not a lookup from a database of some sort). Right now, I create each DataGridCol in an array and use AddRange to add the Columns. Then I populate the Row data using DGV.Rows.Add(RowData) where RowData is an array of strings. The entire grid contents are actually coming from a 2D array of strings. This is functional, but if I wanted to load the data as quickly as possible into the DGV, how would you experts recommend going about it?
Thanks in advance
Hume
Code Excerpt:
Code:
[PlotDataGrid].SuspendLayout()
With [PlotDataGrid]
Dim RowData(CoverData.PlotData.GetUpperBound(1)) As String
[PlotDataGrid].ColumnHeadersVisible = False
[PlotDataGrid].RowHeadersVisible = False
[PlotDataGrid].Rows.Clear()
[PlotDataGrid].Columns.Clear()
Dim Cols(CoverData.PlotData.GetUpperBound(1)) As DataGridViewTextBoxColumn
For i = 0 To CoverData.PlotData.GetUpperBound(1)
Cols(i) = New DataGridViewTextBoxColumn()
Cols(i).Name = ""
Cols(i).HeaderText = ""
If i = 0 Then Cols(i).Frozen = True
Next
[PlotDataGrid].Columns.AddRange(Cols)
For i = 0 To CoverData.PlotData.GetUpperBound(0)
For j = 0 To CoverData.PlotData.GetUpperBound(1)
If Not IsNothing(CoverData.PlotData(i, j)) Then
RowData(j) = CoverData.PlotData(i, j)
Else
RowData(j) = ""
End If
Next j
[PlotDataGrid].Rows.Add(RowData)
Next i
...
End With
[PlotDataGrid].ResumeLayout()
...