Datagrid - Excel help

S

steve

Hi,

I have generated a datagrid with the following columns:

| Date-Time | Station ID | Parameter1 | .... | Parameter 2|

I would like to:

Create an Excel file and preferably give the user a choice to create one
separate Excel file per Station ID.

Also, later on i want to perform various statistics on the data that is too
hard to do with SQL (moving averages, etc.), since a datagrid means that
the data resides in memory , is it the best choice for me?
I mean, Create a Dataset, Populate a Datagrid, then do the statistics
through VB ?

Any suggestions, comments would be greately appreciated!
TIA
-steve
 
I

Ilyan Mishiyev

Something like this can be used to work with Excel in VB.Net.
You might need to download and install
Microsoft.Visual.Studio.Tools.for.the.Microsoft.Office.System to be able to
do this.

Imports Office = Microsoft.Office.Core
Imports Excel = Microsoft.Office.Interop.Excel

objExcel = CreateObject("excel.application")
objBook = objExcel.Workbooks.Open("C:\test.xls")
objSheet = objBook.Worksheets(1)
objSheet.Activate()
objSheet.Cells(1, 1) = "description"
objExcel.ActiveWorkbook.SaveAs( "c:\test.xls" )
objExcel.ActiveWorkbook.Close(savechanges:=False)
objSheet = Nothing
objBook = Nothing
objExcel = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top