Solved

Exporting VB.NET datagrid to an excel sheet

Posted on 2002-03-14
5
417 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now