We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Private Sub cmdExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExport.Click exc = New Excel.Application() Dim r As Integer Dim c As Integer Dim CellsRange As Excel.Range If exc Is Nothing Then Console.WriteLine("ERROR: EXCEL couldn't be started") Exit Sub End If exc.Visible = True Dim workbook As Excel.Workbook = exc.Workbooks.Add Dim WorkSheet As Excel.Worksheet = workbook.Worksheets.Add For r = 0 To gridResults.Rows.Count - 1 For c = 0 To gridResults.Columns.Count - 1 WorkSheet.Cells(r + 2, c + 1) = gridResults.Item(c, r).Value Next Next For c = 0 To gridResults.Columns.Count - 1 WorkSheet.Cells(1, c + 1) = gridResults.Columns(c).HeaderText WorkSheet.Cells(1, c + 1).font.bold = True WorkSheet.Columns(c).autofit() Next End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.