Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy & Paste in Datagrid

Status
Not open for further replies.

astrodestino

IS-IT--Management
Feb 19, 2005
179
AR
Hi!
This is my first time woking with datagrids.
I made an application that will return all the access table contents in a datagrid and if you press the exit button it will write new content entered by the datagrid in the table.
In access when you open a table you can select some rows and copy them (Contro+C) to paste them into exel for example or I can copy them (control+C) and paste in the access database.
I can select all the rows but I cannot copy or paste any data to the datagrid. Can that be done?
Thank you!
 
The datagrid runs off of bound data. What you would want to do is capture the .KeyPress, and not actually paste to the grid, but add the items from the clipboard to the underlying DataTable. You would probably have to iterate though lines of tab-delimited text.
 
General question about datagrids: In VB6, I avoided using them whenever possible, especially to update data. I pretty much felt the same way about binding controls to data, period. I find that most of my VB6 colleagues feel the same way.

Is data binding in the VB.Net world the preferred way to do things? I found that manually populating a ListBox, for example, was a most interesting experience: instantiating a listitem object for each row, overriding its ToString method (which returns the name of the object, rather than its item value), and so on. Of course, it works great, once you have it done, but is it standard practice in .Net to bind a listbox to some kind of data reader?

TIA

Bob
 
You can't say it's preferred or not preferred because it depends on the situation. But because its binding to in-memory collection based objects, you aren't bound to a db cursor.
 
Interesting point, making binding as a concept more internally consistent and simply defined. Thanks River.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top