Hi Faith,
If you want to copy a column in an Excel worksheet to the datagrid, you can
try using OleDB to achieve this. Here's a KB article for you to see how to
connect to an Excel file using OleDB.
http://support.microsoft.com/default...b;en-us;311731
Based on the KB, you have to define a name which indicates the column you
want to copy in the Excel file. This can be done by VBA. If you don't want
the blank cells to be copied, just add WHERE columnname <> NULL after the
SELECT clause.
If anything is unclear, please feel free to reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| Content-Class: urn:content-classes:message
| From: "Faith" <fa***@wwstar.com>
| Sender: "Faith" <fa***@wwstar.com>
| Subject: DataGrid copy/paste from Excel
| Date: Mon, 6 Oct 2003 12:01:46 -0700
| Lines: 17
| Message-ID: <06****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOMPEnLwuvaLw2ZRyivWZ5gJYcj1w==
| Newsgroups: microsoft.public.dotnet.general
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:110924
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Hello.
| I need to take a column from Excel(unknown amount of rows)
| that will be selected by the user and copy those cells.
| Then I will need to paste those cells into the first
| column in a Data Grid (system.windows.forms).
| Basically, the user receives a list of clientIDs from a
| client as an email attachment in Excel listed like:
| 1234 ABC Company
| 234 DEF Company
| 348 GHI Company
| ...and so on
| The user copies the first column of clientIDs and will
| need to paste them into a data grid in a program. Is
| there a way to do this??
|
| Thanks so much for your help!
| Faith
|