Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 952335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:52:41+00:00 2026-05-15T23:52:41+00:00

I am unable to read a pasted datagridviewrow object from the clipboard. All I

  • 0

I am unable to read a pasted datagridviewrow object from the clipboard. All I want to do is, when a user has the entire row selected and copied, I would paste that row into the clipboard as a DataObject. That works just fine but when I attempt to read that DataObject (after the user clicks Paste) the DataGridViewRow that’s saved in the clipboard always has a value of Nothing. Please help!

Here’s the code I’m using for Copy and Paste.

Private Sub copyToClipboard()
    If DataGridView1.CurrentCell IsNot Nothing AndAlso _
        DataGridView1.CurrentCell.Value IsNot Nothing Then
        If DataGridView1.SelectedRows.Count = 1 Then
            My.Computer.Clipboard.SetData(GetType(DataGridViewRow).ToString, getActiveGrid.SelectedRows(0))
        End If
    End If
End Sub

Private Sub pasteFromClipboard()
    Dim oDataObject As IDataObject = My.Computer.Clipboard.GetDataObject
    If oDataObject.GetDataPresent(GetType(DataGridViewRow).ToString) Then
        Dim GridRow As DataGridViewRow = _
            DirectCast(oDataObject.GetData(GetType(DataGridViewRow).ToString), DataGridViewRow)
        ' here's the issue. the variable GridRow always has a value of nothing. 
    End If
End Sub
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:52:41+00:00Added an answer on May 15, 2026 at 11:52 pm

    This is what I use:

        Private Sub mnuCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCopy.Click
        If dgvDisplaySet.GetClipboardContent Is Nothing Then
            MsgBox("Nothing selected to copy to clipboard.")
        Else
            Clipboard.SetDataObject(dgvDisplaySet.GetClipboardContent)
        End If
    End Sub
    

    I also have the data grid view’s clipboardCopyMode property set to EnableAlwaysIncludeHeaderText.

    I want to copy whatever cells they have selected.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read all the contacts from the phone but i am unable
Error: Unable to read data from the transport connection: A blocking operation was interrupted
How do I solve the error: Unable to read WSDL from URL: https://workflowtest.site.edu/_vti_bin/Lists.asmx?WSDL .
I am unable to read the body of a post to my grails controller.
I read quite a number of posts of programmers that run into the Unable
I've read a number of articles about UDP packet sizes but have been unable
Unable to cast object type System.Collections.Generic.List 1[NorthwindMVC3.Models.Product] to the type ofSystem.Collections.Generic.IEnumerator 1[NorthwindMVC3.Models.Product].\ public IEnumerator<Product>
A file name will be passed in from standard in. I want to open
Has anyone else noticed this phenomenon where dbms_output.put_line is unable to print more than
I get the following output for many missing files: warning: Unable to read symbols

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.