Click here to Skip to main content
16,006,828 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Problem in Clearing Items of the Combo Box Pin
Dave Kreskowiak6-Apr-05 13:34
mveDave Kreskowiak6-Apr-05 13:34 
GeneralRe: Problem in Clearing Items of the Combo Box Pin
Anonymous7-Apr-05 21:44
Anonymous7-Apr-05 21:44 
GeneralFormatting numbers in a datagrid Pin
j1webb6-Apr-05 6:29
j1webb6-Apr-05 6:29 
GeneralRe: Formatting numbers in a datagrid Pin
Dave Kreskowiak7-Apr-05 4:41
mveDave Kreskowiak7-Apr-05 4:41 
GeneralRe: Formatting numbers in a datagrid Pin
j1webb7-Apr-05 10:28
j1webb7-Apr-05 10:28 
GeneralOptimisation Model Solution Routine(Linear Programming) Pin
karmond6-Apr-05 6:00
karmond6-Apr-05 6:00 
GeneralRe: Optimisation Model Solution Routine(Linear Programming) Pin
Dave Kreskowiak7-Apr-05 4:10
mveDave Kreskowiak7-Apr-05 4:10 
GeneralDatagrid Exporting to Excel Format Pin
Scttsmpsn6-Apr-05 4:53
Scttsmpsn6-Apr-05 4:53 
I am using the following code from :http://www.kjmsolutions.com/datasetarray.htm[^]

to export data from a datagrid to Excel. The issue I have is that in my grid I have a field which holds the value: 00124544545454545 which represents a code.

Excel displays: 1+32323 a scientific number. I am at a loss on how to force a format to a cell to display this as text. The datagrid can show to datasets that differ in columns and thus it must be dynamic.

Any ideas?

Dim Excel As New Excel.Application
Dim oBook As Excel.Workbook
Dim WSheet As New Excel.Worksheet

Dim rows As Integer = dsDataset.Tables(0).Rows.Count
Dim columns As Integer = dsDataset.Tables(0).Columns.Count
Dim r As Integer
Dim c As Integer
Dim DataArray(rows, columns) As Object

Dim sString As String

WSheet = Excel.Workbooks.Add.Worksheets.Add
Excel.Visible = True

For c = 0 To columns - 1
DataArray(r, c) = dsDataset.Tables(0).Columns.Item(c).ColumnName

For r = 0 To rows - 1
DataArray(r, c) = dsDataset.Tables(0).Rows(r).Item(c)

Next

Next
'Transfer record data from array to Excel


WSheet.Range("A2").Resize(rows, columns).Value = DataArray

Dim columns2 As Integer
Dim columns3 As Integer = 1

For columns2 = 0 To dsDataset.Tables(0).Columns.Count - 1
WSheet.Cells(1, columns3).Value = dsDataset.Tables
(0).Columns(columns2).ColumnName

columns3 = columns3 + 1

Next


Cheers,

Scott
GeneralRe: Datagrid Exporting to Excel Format Pin
Scttsmpsn6-Apr-05 8:25
Scttsmpsn6-Apr-05 8:25 
QuestionSwitching language programmatically ? Pin
kil0byte^bandit6-Apr-05 4:30
kil0byte^bandit6-Apr-05 4:30 
GeneralMachine.Config Pin
Jason Weibel6-Apr-05 4:25
Jason Weibel6-Apr-05 4:25 
GeneralRe: Machine.Config Pin
Dave Kreskowiak6-Apr-05 4:59
mveDave Kreskowiak6-Apr-05 4:59 
GeneralConvert to(from) Julian Date Format from(to) Calendar Date Pin
Dile6-Apr-05 2:52
Dile6-Apr-05 2:52 
GeneralRe: Convert to(from) Julian Date Format from(to) Calendar Date Pin
kil0byte^bandit6-Apr-05 4:54
kil0byte^bandit6-Apr-05 4:54 
Generalvb Pin
royrana6-Apr-05 1:30
royrana6-Apr-05 1:30 
QuestionDeclare variable at runtime?? Pin
Sheel Gohe5-Apr-05 23:07
Sheel Gohe5-Apr-05 23:07 
AnswerRe: Declare variable at runtime?? Pin
Dave Kreskowiak6-Apr-05 2:20
mveDave Kreskowiak6-Apr-05 2:20 
GeneralRe: Declare variable at runtime?? Pin
royrana6-Apr-05 23:59
royrana6-Apr-05 23:59 
GeneralCOM property from VB Pin
Anonymous5-Apr-05 22:50
Anonymous5-Apr-05 22:50 
GeneralRe: COM property from VB Pin
Dave Kreskowiak6-Apr-05 2:19
mveDave Kreskowiak6-Apr-05 2:19 
GeneralUsing Access 2003 Methods Pin
dpagka5-Apr-05 19:29
dpagka5-Apr-05 19:29 
GeneralRe: Using Access 2003 Methods Pin
Dave Kreskowiak6-Apr-05 2:17
mveDave Kreskowiak6-Apr-05 2:17 
Generalopen ascii file Pin
toto_plg5-Apr-05 19:03
toto_plg5-Apr-05 19:03 
GeneralRe: open ascii file Pin
Christian Graus5-Apr-05 19:44
protectorChristian Graus5-Apr-05 19:44 
GeneralRe: open ascii file Pin
dpagka5-Apr-05 20:03
dpagka5-Apr-05 20:03 

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.