We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Copy Paste and Speed

Thread ID:

Created:

Updated:

Platform:

Replies:

28244 Apr 27,2005 03:01 PM Apr 29,2005 03:12 PM Windows Forms 7
loading
Tags: GridControl
Philip Bishop
Asked On April 27, 2005 03:01 PM

Im attaching a sample i was hoping you could help me figure out. run the sample and type 99.99 in cell 1,1 and then move off and then back on the cell and do a ctrl-c. then click column header "A" and then drag ur mouse all the way over until all cols are selected up to the last one "AF". Now do a ctrl-v and it seems to only take me about 2 seconds tops. Now close the app and bring up excel. Type in 99.99 in a cell and copy that cell in excel. Run my app again and this time just select all the cols again as i had you do above. Now do the ctrl-v. Now this takes me about 5 to 8 seconds. Whats the diff between copying from grid to grid versus excel to grid that slow you down that much. Any idea? I will email this file in case it doesnt send.

Administrator [Syncfusion]
Replied On April 27, 2005 04:44 PM

Hi Philip, The sample is not attached. When you run the application in the VS, did you see any exceptions in the output window of Visual Studio? Regards, Thomas >Im attaching a sample i was hoping you could help me figure out. run the sample and type 99.99 in cell 1,1 and then move off and then back on the cell and do a ctrl-c. then click column header "A" and then drag ur mouse all the way over until all cols are selected up to the last one "AF". Now do a ctrl-v and it seems to only take me about 2 seconds tops. Now close the app and bring up excel. Type in 99.99 in a cell and copy that cell in excel. Run my app again and this time just select all the cols again as i had you do above. Now do the ctrl-v. Now this takes me about 5 to 8 seconds. Whats the diff between copying from grid to grid versus excel to grid that slow you down that much. Any idea? I will email this file in case it doesnt send.

Administrator [Syncfusion]
Replied On April 28, 2005 08:34 AM

The sample wasnt attached to this because the upload feature is still having problems. So i emailed it directly to syncfusion support

Administrator [Syncfusion]
Replied On April 28, 2005 08:41 AM

Ok i checked this and i did email it. You want the email that has this forumn number and the file is called copypastespeed.zip. I had sent another question and sample after this and left the same forum number on the subject. I resent that one this morning.

Administrator [Syncfusion]
Replied On April 28, 2005 09:21 AM

Hi Philip, I''m don''t work at Syncfusion, so I cannot receive the mails. The past day''s I haven''t any problems to upload files. Regards, thomas

Administrator [Syncfusion]
Replied On April 29, 2005 09:43 AM

I figured that. I will see what syncfusion has.

Administrator [Syncfusion]
Replied On April 29, 2005 02:13 PM

Try modifying your ClipboardPaste function as below. You are constanting retrieiving the same value from the clipboard in the loop. As noted earlier in one of your threads, excel puts a newline at the end of its copy of a single cell. Just constantly getting this string with the newline from the clipboard object is slowing things down. (If you type 99.99 in NotePad and copy the exact 5 characters 99.99, you do not see this delay with your original code.)
Private Function ClipboardPaste(ByVal dg As Grid.GridControl) As Boolean

    Try
      Cursor = Cursors.WaitCursor

      Dim intRow, intCol As Integer
      Dim objRow As Grid.GridRangeInfo

      Dim objRange As Grid.GridRangeInfo = dg.Selections.Ranges.ActiveRange
      objRange = objRange.ExpandRange(1, 1, dg.RowCount, dg.ColCount)

      '' Declares an IDataObject to hold the data returned from the clipboard.
      '' Retrieves the data from the clipboard.
      Dim iData As IDataObject = Clipboard.GetDataObject()
      Dim strText() As String

      ''If there is more than one row, return false so that the paste can proceed.
      strText = Split(CType(iData.GetData(DataFormats.Text), String), vbNewLine)
      If strText.GetUpperBound(0) > 1 Then
        Return False
        Exit Function
      End If

      ''If there is more than one column, return
      strText = Split(CType(iData.GetData(DataFormats.Text), String), vbTab)
      If strText.GetUpperBound(0) > 0 Then
        Return False
        Exit Function
      End If

      ''If the paste is a single cell, return false so that the paste can proceed.
      If objRange.Top = objRange.Bottom And objRange.Left = objRange.Right Then
        Return False
            End If

            Dim pasteValue As String = CType(iData.GetData(DataFormats.Text), String)
            pasteValue = pasteValue.Trim()
            Try
                Dim i As Single = Single.Parse(pasteValue)
                Select Case i
                    Case 0.0F To 99.99F
                    Case Else
                        Throw New Exception("")
                End Select
            Catch
                MessageBox.Show("Paste function terminated.  Data doesn''t match cell type or is outside of cell value limits.", _
                  "QUASAR:  Edit Cell Value Warning", MessageBoxButtons.OK, _
                  MessageBoxIcon.Warning)
                Return True ''false
            End Try

            ''Loop through the selected rows and paste the value into each cell.
            For intRow = objRange.Top To objRange.Bottom
                Try
                    Cursor = Cursors.WaitCursor
                    ''Paste into each cell for the row.
                    For intCol = objRange.Left To objRange.Right
                       
                        '' Determines whether the data is in a format you can use.
                        If iData.GetDataPresent(DataFormats.Text) Then
                            ''Put the clipboard value into the cell.
                            If dg(intRow, 0).Text = "  ....  " OrElse _
                              dg(intRow, intCol).Clickable = False Then
                                ''''''Skip Non Issue Read only cells 
                            Else
                                data(intRow, intCol).SetValue(data(intRow, intCol).CellValueProperty, pasteValue)
                            End If
                        End If
                    Next

                Catch ex As System.Exception
                    MessageBox.Show(ex.ToString)
                Finally
                    Cursor = Cursors.Default
                End Try
            Next
            Return True

        Catch ex As System.Exception
      MessageBox.Show(ex.ToString)
    Finally
      Cursor = Cursors.Default
    End Try

  End Function

Administrator [Syncfusion]
Replied On April 29, 2005 03:12 PM

That made a HUGE difference. Takes no time at all now. Thanks Clay

CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;