Solved

Exporting VB.NET datagrid to an excel sheet

Posted on 2002-03-14
5
424 Views
Last Modified: 2010-05-02
Hi,

anyone got any code so that I can export a VB.NET datagrid dataset to an excel sheet?

Thanks,

Del.
0
Comment
Question by:deljones
5 Comments
 
LVL 17

Expert Comment

by:inthedark
ID: 6864138
Simple was is to place the grid onto the clipboard, then is can be pasted anywhere:

The clipboard format required by excel is like:


Field1 TAB Field2 TAB Field3 TAB Field4 vbCrLf

Where tab is CHR(9)

Each row looks the same.
0
 

Author Comment

by:deljones
ID: 6864157
Thanks,

but I really need to do it in code.  I want my users to be able to export at will to an excel sheet.
0
 
LVL 44

Accepted Solution

by:
bruintje earned 300 total points
ID: 6865660
Hi deljones, don't know if there are any sample exactly like your question but i guess with these samples you can get to it

Microsoft Knowledge Base articles can be found at:
http://search.support.microsoft.com/kb/c.asp
Choose to search by "specific article ID number"
Enter the article number including the "Q"

dotNet
------
Q306022 HOW TO: Transfer Data to an Excel Workbook Using Visual Basic .NET
(pending)
Q306572 HOW TO: Query and Display Excel Data Using ASP.NET, ADO.NET
Q311731 HOW TO: Query and Display Excel Data Using ADO.NET, VB .NET

General
-------
Q257819 HOWTO: Use ADO with Excel Data from Visual Basic or VBA
Q303814 HOWTO: Use ADOX with Excel Data from Visual Basic or VBA

Transferring Data into Excel
----------------------------
Q247412 INFO: Methods for Transferring Data to Excel from Visual Basic
Q295646 HOWTO: Transfer Data from ADO Data Source to Excel with ADO

HTH:O)Bruintje
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7618284
Hi deljones,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bruintje's comment(s) as an answer.

deljones, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7665726
Moving to the paq

kb
Experts Exchange Moderator
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question