473,698 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagridview copy and paste

Hi everyone,
I found resources on the web to do a copy on a datagridview control but i
havent found any on pasting back to the control. I m trying to figure out
how to do a shallow copy on a datagrid row.
if (c is DataGridView)

{

DataGridView d = (DataGridView)c ;

Clipboard.SetDa taObject(d.GetC lipboardContent ());

}
Can someone please point me out to resources on how to paste cells copied
this way into the datagrid. Links or pointers will be appreciated.

- idatarm
Aug 1 '07 #1
1 5229
The Tarm,

Doing so would be very difficult. You would have to basically figure
out when you want the paste operation to occur, and then parse the
information from the clipboard into a two-dimensional array of values. Once
you have that, you would have to traverse the cells and paste the values
into the cells.

You might want to consider overriding the GetClipboardCon tent and
placing the information on the clipboard which is easier to figure out the
values of, as right now, you are getting a comma delimited file, html, and
text.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"The Tarm"
<Pl************ *************** *************** **********@yaho o.comwrote in
message news:uy******** ******@TK2MSFTN GP03.phx.gbl...
Hi everyone,
I found resources on the web to do a copy on a datagridview control but i
havent found any on pasting back to the control. I m trying to figure out
how to do a shallow copy on a datagrid row.
if (c is DataGridView)

{

DataGridView d = (DataGridView)c ;

Clipboard.SetDa taObject(d.GetC lipboardContent ());

}
Can someone please point me out to resources on how to paste cells copied
this way into the datagrid. Links or pointers will be appreciated.

- idatarm
Aug 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
32268
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate datatable without having to loop through each column in the datagridview? Or is there a way to retrieve the rows from the original datatable filtered by the dataview into a separate table? I only want to copy the rows from the main table that...
3
94256
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my database. For example: table JobTypes 1 | Manager 2 | Controller 3 | Supervisor table Employee
0
4642
by: MKBender | last post by:
dear all, I have a dataGridView that has cut,copy, and paste functionality for the cells of the datagrid but now I would like to add the functionality for the user to copy, cut and paste an entire row and rows. Can any one give me some code on how to use the clipboard for entire rows? I don't know how to format the data in a way that it can be inserted into the dataGridView? thanks for the help, Matthew
0
912
by: tom | last post by:
I using VS2005 and trying to use a Context Menu to Copy, Cut & Paste cell data within the DataGridView control and I am finding that this is beyond my limited knowledge. If anybody has a few examples to get me started I would appreciate it.
0
1170
by: Chris | last post by:
I have a DataGridView in a form that will display the information from various DataTables in my DataSet. The user is provided a list of tables and when they select a table name, the DataGridView displays the appropriate DataTable. When a user changes some of the settings in my program, I sometimes have to recreate some of the DataTables, however, the DataGridView will still somehow display the original DataTable even if the DataGridView...
2
13639
by: ing.Zeco | last post by:
I need usage possibility when I double click on any row in datagridview, that row must be copied in second datagridview. Any good link about that?!
0
2058
nirmalsingh
by: nirmalsingh | last post by:
hi all, i am using datatable and dataset to assign data into datagridview. now i want to print data of datagridview contents. i used a method to copy datagridview content in a clipboard and to paste it in a print document. it is working fine but data is unaligned, so i think that if i apply borderstyle to datagridview and then copy to clipboard, but it doesnt work fine. anybody tell me the solution to resolve this. my another question is,...
0
1991
by: Robert | last post by:
Hi! I want to fill the clipboard programmatically in oder to manual copy the data to word. The data consists of cells of a grid which contains text or images. Using the standard copy/paste of the dataGridView only the text-cells are copied and pasted in word, the image-cells are empty. How can I build an IDataObject that can contain text and images like it is possible when copy from word to word?
2
4639
by: TG | last post by:
Hi! I am trying to export only the visible columns from a datagridview in my windows form in VB 2008. Should't it be no comma after the first row where the headers are? Also should there be a comma at the last row?
0
8675
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6521
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.