BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
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