Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
3292 | Mar 12,2003 03:05 AM UTC | Mar 14,2003 07:35 AM UTC | WinForms | 6 |
![]() |
Tags: GridControl |
this.GridControl1.TableStyle.CellType = "FormulaCell";
I then run the app and type 1 into cell A10. Then I go to cell A1 and type =A2. In cell A2, I type =A3, and so on, until in cell A9 I type =A10.
Is this what you are describing? When I do this, I see nothing until cell I type =A10 into cell A9. Then I see all 1's in the first column. What would you expect different, or are you doing something different? What version of the grid are you using, I am using the latest version, 1.5.2.0.
As far as the virtual grid problem, can you post a sample showing the problem?
//CSV CODE //save text private void button3_Click(object sender, System.EventArgs e) { this.gridControl1.Model.TextDataExchange.ExportTabDelim = ","; string outPut; int nRows, nCols; GridRangeInfoList rangeInfoList = new GridRangeInfoList(); rangeInfoList.Add(GridRangeInfo.Cells(1, 1, this.gridControl1.RowCount, this.gridControl1.ColCount)); bool b = this.gridControl1.Model.TextDataExchange.CopyTextToBuffer(out outPut, rangeInfoList, out nRows, out nCols); if(b) { StreamWriter writer = new StreamWriter("test.csv"); writer.Write(outPut); writer.Close(); } } //load text private void button4_Click(object sender, System.EventArgs e) { this.gridControl1.Model.TextDataExchange.ImportTabDelim = ","; StreamReader reader = new StreamReader("test.csv"); string s = reader.ReadToEnd(); reader.Close(); this.gridControl1.BeginUpdate(); //reset grid this.gridControl1.RowCount = 1; this.gridControl1.ColCount = 1; this.gridControl1.Model.TextDataExchange.PasteTextFromBuffer(s, GridRangeInfo.Cell(1,1), 0); this.gridControl1.EndUpdate(); }2) There is no method to support copying values to an array. But you can spend up looping through the cells by directly accessing the GridData object instead of using a direct indexer on the GridControl. We are talking of speeding things up by 100 to 200 times. If you need direct access to a significant amount of data, then going through the GridData object is worth the effort. Below is a code snippet.
//C# private void button2_Click(object sender, System.EventArgs e) { //GridData method int start = Environment.TickCount; int[,] A = new int[this.gridControl1.RowCount, this.gridControl1.ColCount]; GridData data = this.gridControl1.Model.Data; for(int row = 1; row <= this.gridControl1.RowCount; ++ row) for(int col = 1; col <= this.gridControl1.ColCount; ++col) { A[row-1, col-1] = (int) (new GridStyleInfo(data[row, col])).CellValue; } Console.WriteLine("GridData {0}", Environment.TickCount-start); } 'VB.NET Private Sub button2_Click(sender As Object, e As System.EventArgs) 'GridData method Dim start As Integer = Environment.TickCount Dim A(Me.gridControl1.RowCount, Me.gridControl1.ColCount) As Integer Dim data As GridData = Me.gridControl1.Model.Data Dim row As Integer While row <= Me.gridControl1.RowCount Dim col As Integer While col <= Me.gridControl1.ColCount A(row - 1, col - 1) = CInt(New GridStyleInfo(data(row, col)).CellValue) End While End While Console.WriteLine("GridData {0}", Environment.TickCount - start) End Sub 'button2_Click
For row = 1 to Me.gridControl1.RowCount For col = 1 to Me.gridControl1.ColCount A(row - 1, col - 1) = CInt(New GridStyleInfo(data(row, col)).CellValue) Next Next
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.