Click here to Skip to main content
15,911,711 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Forms in VB.NET Pin
Gopi.V30-Sep-05 22:43
Gopi.V30-Sep-05 22:43 
GeneralRe: Forms in VB.NET Pin
alongi3-Oct-05 5:36
alongi3-Oct-05 5:36 
QuestionHow can i get the value of Mathematical Function at any point? Pin
Arfan Qadir30-Sep-05 19:04
Arfan Qadir30-Sep-05 19:04 
AnswerRe: How can i get the value of Mathematical Function at any point? Pin
Dave Kreskowiak1-Oct-05 3:11
mveDave Kreskowiak1-Oct-05 3:11 
QuestionReceive FAX Pin
Tad McClellan30-Sep-05 14:49
professionalTad McClellan30-Sep-05 14:49 
QuestionKey event question Pin
KaptinKrunch30-Sep-05 10:42
KaptinKrunch30-Sep-05 10:42 
AnswerRe: Key event question Pin
Richard_Wolf30-Sep-05 11:32
Richard_Wolf30-Sep-05 11:32 
QuestionExporting a Datagrid to Excel Pin
raysot77730-Sep-05 9:15
raysot77730-Sep-05 9:15 
Hello,

I am trying to export the contents of a datagrid to Excel.
Here's the code I have so far:

<small> 'Fire up an Excel instance
Dim ExcelApp As New Excel.Application
ExcelApp.Visible = True

Dim workbooks As Workbooks = ExcelApp.Workbooks
Dim workbook As _Workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet)

Dim sheets As Sheets = workbook.Worksheets
Dim worksheet As _Worksheet = CType(sheets.Item(1), _Worksheet)

'Put some data on the Worksheet -- This doesn't work, but throws no errors
Dim nCell As Integer = 5

Dim Range2 As Range = worksheet.Range("A1", "E1")
Dim array2(nCell) As Integer
Dim i As Integer
For i = 0 To (array2.GetLength(0)) - 1
array2(i) = i + 1
Next

Dim args2(1) As Object
args2(0) = array2
Range2.GetType().InvokeMember("Value", BindingFlags.SetProperty, Nothing, Range2, args2)</small>

Everything works except the last line. Actually, the only thing I have been successful at doing was getting the Excel app to fire up. Beyond that I am left looking at beautiful, although empty, white cells.

I'm using VS.Net 2005 latest beta.

It seems simple enough... Read a datagrid, send the results to an Excel worksheet. I would use the more accepted method of using Response.Write, but due to our website configuration, things get all screwed up with using a Master page and <form> tags.

If anyone can help me out of this bind, I would be a very happy programmer.
AnswerRe: Exporting a Datagrid to Excel Pin
Dave Kreskowiak30-Sep-05 9:27
mveDave Kreskowiak30-Sep-05 9:27 
GeneralRe: Exporting a Datagrid to Excel Pin
raysot77730-Sep-05 10:05
raysot77730-Sep-05 10:05 
GeneralRe: Exporting a Datagrid to Excel Pin
Dave Kreskowiak1-Oct-05 3:04
mveDave Kreskowiak1-Oct-05 3:04 
GeneralRe: Exporting a Datagrid to Excel Pin
raysot7771-Oct-05 9:38
raysot7771-Oct-05 9:38 
QuestionRefreshing Reports in Crystal Reports 9 Pin
shoaibnawaz30-Sep-05 8:53
shoaibnawaz30-Sep-05 8:53 
QuestionHow do you calc the absolute location of a control? Pin
watagal30-Sep-05 8:06
watagal30-Sep-05 8:06 
AnswerRe: How do you calc the absolute location of a control? Pin
rwestgraham30-Sep-05 9:28
rwestgraham30-Sep-05 9:28 
QuestionRe: How do you calc the absolute location of a control? Pin
watagal30-Sep-05 13:39
watagal30-Sep-05 13:39 
AnswerRe: How do you calc the absolute location of a control? Pin
rwestgraham30-Sep-05 15:34
rwestgraham30-Sep-05 15:34 
AnswerRe: How do you calc the absolute location of a control? Pin
watagal1-Oct-05 3:33
watagal1-Oct-05 3:33 
QuestionRe: How do you calc the absolute location of a control? Pin
watagal1-Oct-05 3:54
watagal1-Oct-05 3:54 
AnswerRe: How do you calc the absolute location of a control? Pin
[Marc]1-Oct-05 5:45
[Marc]1-Oct-05 5:45 
QuestionInfinite loop - Resizing Form Pin
watagal30-Sep-05 7:06
watagal30-Sep-05 7:06 
AnswerRe: Infinite loop - Resizing Form Pin
Richard_Wolf30-Sep-05 7:52
Richard_Wolf30-Sep-05 7:52 
AnswerRe: Infinite loop - Resizing Form Pin
Member 219430730-Sep-05 7:55
Member 219430730-Sep-05 7:55 
AnswerRe: Infinite loop - Resizing Form Pin
Dave Kreskowiak30-Sep-05 7:56
mveDave Kreskowiak30-Sep-05 7:56 
AnswerRe: Infinite loop - Resizing Form Pin
watagal30-Sep-05 8:09
watagal30-Sep-05 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.