473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Export datagrid contents to EXCEL

I would like to export earnigs of employees from datagrid to EXCEL.

for example:
__________________________
|..name.............|..money...............|
-----------------------------------
|..John..............|..100$.................|
|..Mary.............|...150S...............|
-----------------------------------

Sum: 250$ (sum is a label)

I would like to export both of them : contents of grid and text of label.
By the most important for me is datagrid - is there any easy way?
Nov 21 '05 #1
8 4610
Hi Chreo!

"chreo" schrieb
I would like to export earnigs of employees from datagrid to EXCEL.


HOW TO: Transfer Data to an Excel Workbook by Using Visual Basic .NET
http://support.microsoft.com/default...b/306022/en-us

Cheers

Arne Janning
Nov 21 '05 #2
Chreo,

A datagrid holds no data, it shows data that is in an object.

Therefore it is almost impossible to transfer data from a datagrid to Excel.

Cor
Nov 21 '05 #3
Oh....datagrid holds no data? :(

So there won't be export to excel in my application :-)
Nov 21 '05 #4
>
So there won't be export to excel in my application :-)

When you want help than you have to show what kind of object the datagrid is
using to display the data. Can be a dataset, dataview, datatable, arraylist
etc. etc.

Assuming it is a windows form appliction what I assume because you did not
told what kind of datagrid it was. Windows form is than default in this
newsgroup.

Cor
Nov 21 '05 #5
I use Private Sub to fill datagrid.
I create connection, command, dataadapter and dataset.
But these are local objects and they live as long as procedure lives - am I
right? :)
So I thought that values stay in datagrid but these data-objects don't exist
anymore.
Dim conZarobki As New SqlClient.SqlConnection
Dim comWyswietlZarobki As New SqlClient.SqlCommand
Dim daZarobki As New SqlClient.SqlDataAdapter
Dim dsZarobki As New DataSet
Dim Miesiac As Date
Miesiac = datData.Value
conZarobki.ConnectionString = FormLogowanie.strPolaczenie

With comWyswietlZarobki
..Connection = conZarobki
..CommandText = "SELECT * FROM " & "POKAZ_ZAROBEK_DWD" & "(@LOGIN,@DATA)"
..Parameters.Add("@LOGIN", SqlDbType.VarChar)
..Parameters.Add("@DATA", SqlDbType.SmallDateTime)
..Parameters(0).Value = cmbLogin.Text
..Parameters(1).Value = Miesiac
End With

daZarobki.SelectCommand = comWyswietlZarobki
daZarobki.Fill(dsZarobki, "ZAROBKI")

dgrZarobki.DataSource = dsZarobki.Tables("ZAROBKI")
Nov 21 '05 #6
Had the same problem a few days ago.

I suggest you start by reading the following MSDN documentation:
http://support.microsoft.com/default...b;en-us;247412
and check the REFERENCES at the bottom for document#: 306022, which is
better and more extensive.

good luck!

"chreo" <ch***@gazeta.pl> a écrit dans le message de news:
d5**********@inews.gazeta.pl...
I would like to export earnigs of employees from datagrid to EXCEL.

for example:
__________________________
|..name.............|..money...............|
-----------------------------------
|..John..............|..100$.................|
|..Mary.............|...150S...............|
-----------------------------------

Sum: 250$ (sum is a label)

I would like to export both of them : contents of grid and text of label.
By the most important for me is datagrid - is there any easy way?

Nov 21 '05 #7
Chreo,

This is a link to a page from Scorpion.
Who I saw the last days again in this newsgroups.

http://www.kjmsolutions.com/datasetarray.htm

I hope this helps

Dobry Wieczór

Cor
Nov 21 '05 #8
THANX - I THINK THAT WILL HELP.

I will try it tomorrow because my problem number one is connecting application to SQL server using IP and username and password:
topic: http://www.developersdex.com/vb/mess...4053663&p=1121
----------------------------
Dobry wieczór Cor :)

Uzytkownik "Cor Ligthert" <no************@planet.nl> napisal w wiadomosci news:%2******************@TK2MSFTNGP14.phx.gbl...
Chreo,

This is a link to a page from Scorpion.
Who I saw the last days again in this newsgroups.

http://www.kjmsolutions.com/datasetarray.htm

I hope this helps

Dobry Wieczór

Cor
Nov 21 '05 #9

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

Similar topics

1
by: Rob | last post by:
I was looking for the easiest way to take a datagrid full of data including two template columns, and export the contents of the grid into Excel by giving an "open or save as" box. I came across...
5
by: Maria L. | last post by:
Hi, I need to export the content of a DataGrid (in Windows application in C#), into an Excel spreadsheet. Anyone knows how to do this? Any code snippets would help! thanks a lot, Maria
1
by: Ugo | last post by:
Hi, I am having a problem exporting a Datagrid to excel in asp.net. For some reason I am getting a blank excel page. I set up in IIS the Mime for ..xls. My code is below any help would be...
2
by: Bidarkota | last post by:
Hi, I have a DataGrid in which there are some images and Data are displayed and in the webform.asp page i am using some stylesheets. when i export the datagrid all the images are also exported...
3
by: Bidarkota | last post by:
When i export DataGrid to Excel all the HTML contents are also exporting to excel. i am using stylesheets in the ASPX Page and i am getting an alert message that stylesheets are missing. i need to...
4
by: Frank | last post by:
Hello All, I ham using VS.NET 2003. Have followed instructions from http://gridviewguy.com/ArticleDetails.aspx?articleID=26 along with several other articles to no avail. I am pulling my hair...
1
by: cehether | last post by:
Hello everyone. I am trying to export the contents of a DataGrid to MS Excel using VB.NET 2003. I read of a couple different ways of doing that here (though I couldn't tell which version of...
1
by: Arch Stanton | last post by:
I export the contents of my datagrid controls to Excel using the following Sub: Sub WriteToExcel(Sender as Object, E as EventArgs) Response.Clear() Response.ContentType =...
0
by: Arch Stanton | last post by:
I'm writing the contents of my datagrid to an Excel spreadsheet using the following code: Sub WriteToExcel(Sender as Object, E as EventArgs) 'Export the contents of the current datagrid to Excel...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.