Click here to Skip to main content
16,006,768 members
Home / Discussions / C#
   

C#

 
Questionform's opacity Pin
adel_soli30-Apr-07 14:35
adel_soli30-Apr-07 14:35 
AnswerRe: form's opacity Pin
Christian Graus30-Apr-07 14:47
protectorChristian Graus30-Apr-07 14:47 
GeneralRe: form's opacity Pin
adel_soli1-May-07 1:30
adel_soli1-May-07 1:30 
GeneralRe: form's opacity Pin
Christian Graus1-May-07 1:49
protectorChristian Graus1-May-07 1:49 
GeneralRe: form's opacity Pin
adel_soli1-May-07 2:40
adel_soli1-May-07 2:40 
GeneralRe: form's opacity Pin
PIEBALDconsult3-May-07 9:11
mvePIEBALDconsult3-May-07 9:11 
GeneralRe: form's opacity Pin
PIEBALDconsult3-May-07 9:16
mvePIEBALDconsult3-May-07 9:16 
QuestionExporting to Excel using C# and Visual Studio 2005 Pin
laura131630-Apr-07 14:24
laura131630-Apr-07 14:24 
Hi All,

I have created a project that exports data to Excel. I take some samples and display it using excel. I have 4 columns: time, X, Y, Z data. The X,Y,Z data is integer data and exports perfectly. The time column doesn't work. I create the array and then I try to export it, but for some reason with double it changes all the array to the first time value .1s and if I have it as a string instead it changes all the values in the array to the final read value. Does anyone know how to display the time. I am taking a sample every 100ms so I am trying to do an elapsed timer. Please help. Below is my export to excel function:

<br />
private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            timerTakeData.Enabled = false;<br />
            radioButton10.Enabled = true;<br />
            radioButton100.Enabled = true;<br />
            radioButton20.Enabled = true;<br />
            radioButton200.Enabled = true;<br />
            radioButton50.Enabled = true;<br />
            button1.Enabled = true;<br />
<br />
            labelTime.Text = "0.00";<br />
            Excel.Workbooks ExcelBooks;<br />
            Excel.Sheets ExcelSheets;<br />
            Excel._Worksheet ExcelSheet;<br />
            Excel.Range range;<br />
 timerTakeData.Enabled = false;<br />
            radioButton10.Enabled = true;<br />
            radioButton100.Enabled = true;<br />
            radioButton20.Enabled = true;<br />
            radioButton200.Enabled = true;<br />
            radioButton50.Enabled = true;<br />
            button1.Enabled = true;<br />
<br />
            labelTime.Text = "0.00";<br />
            Excel.Workbooks ExcelBooks;<br />
            Excel.Sheets ExcelSheets;<br />
            Excel._Worksheet ExcelSheet;<br />
            Excel.Range range;<br />
            try<br />
            {<br />
                // Instantiate Excel and start a new workbook.<br />
                ExcelApp = new Excel.Application();<br />
                ExcelBooks = ExcelApp.Workbooks;<br />
                ExcelBook = ExcelBooks.Add(Missing.Value);<br />
                ExcelSheets = ExcelBook.Worksheets;<br />
                ExcelSheet = (Excel._Worksheet)ExcelSheets.get_Item(1);<br />
<br />
                ExcelSheet.Cells[1, 1] = "Time";<br />
                ExcelSheet.Cells[1, 2] = "X A/D";<br />
                ExcelSheet.Cells[1, 3] = "Y A/D";<br />
                ExcelSheet.Cells[1, 4] = "Z A/D";<br />
                ExcelSheet.get_Range("A1", "D1").Font.Bold = true;<br />
                ExcelSheet.get_Range("A1", "D1").VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;<br />
<br />
                range = ExcelSheet.get_Range("A2", Missing.Value);<br />
                range = range.get_Resize(cnt, 1);<br />
                range.set_Value(Missing.Value, time);<br />
                range = ExcelSheet.get_Range("B2", Missing.Value);<br />
                range = range.get_Resize(cnt, 1);<br />
                range.set_Value(Missing.Value, xVolt);<br />
                range = ExcelSheet.get_Range("C2", Missing.Value);<br />
                range = range.get_Resize(cnt, 1);<br />
                range.set_Value(Missing.Value, yVolt);<br />
                range = ExcelSheet.get_Range("D2", Missing.Value);<br />
                range = range.get_Resize(cnt, 1);<br />
                range.set_Value(Missing.Value, zVolt);<br />
                //Return control of Excel to the user.<br />
                ExcelApp.Visible = true;<br />
                ExcelApp.UserControl = true;<br />
            }<br />
            catch (Exception theException)<br />
            {<br />
                String errorMessage;<br />
                errorMessage = "Error: ";<br />
                errorMessage = String.Concat(errorMessage, theException.Message);<br />
                errorMessage = String.Concat(errorMessage, " Line: ");<br />
                errorMessage = String.Concat(errorMessage, theException.Source);<br />
<br />
                MessageBox.Show(errorMessage, "Error");<br />
            }<br />
            cnt = 0;<br />
            clockCnt = 10.0;<br />
}<br />

Questionimportanat Pin
hazem maher30-Apr-07 14:17
hazem maher30-Apr-07 14:17 
AnswerRe: importanat Pin
adel_soli30-Apr-07 14:44
adel_soli30-Apr-07 14:44 
AnswerRe: importanat Pin
Christian Graus30-Apr-07 14:47
protectorChristian Graus30-Apr-07 14:47 
QuestionSimple math dividing Pin
laura131630-Apr-07 11:01
laura131630-Apr-07 11:01 
AnswerRe: Simple math dividing Pin
led mike30-Apr-07 11:07
led mike30-Apr-07 11:07 
AnswerRe: Simple math dividing Pin
Luc Pattyn30-Apr-07 14:57
sitebuilderLuc Pattyn30-Apr-07 14:57 
AnswerRe: Simple math dividing Pin
Arun.Immanuel30-Apr-07 15:31
Arun.Immanuel30-Apr-07 15:31 
QuestionEmulator Pin
The Brazilian One30-Apr-07 10:36
The Brazilian One30-Apr-07 10:36 
AnswerRe: Emulator Pin
Dave Kreskowiak30-Apr-07 12:29
mveDave Kreskowiak30-Apr-07 12:29 
QuestionHow to create a sudoku like playfield Pin
tears.of.angels30-Apr-07 10:08
tears.of.angels30-Apr-07 10:08 
AnswerRe: How to create a sudoku like playfield Pin
Christian Graus30-Apr-07 12:02
protectorChristian Graus30-Apr-07 12:02 
QuestionShortcut key with 2 Letters Pin
Pedro Luz30-Apr-07 10:07
Pedro Luz30-Apr-07 10:07 
AnswerRe: Shortcut key with 2 Letters Pin
Dan Neely30-Apr-07 10:41
Dan Neely30-Apr-07 10:41 
GeneralRe: Shortcut key with 2 Letters Pin
Pedro Luz30-Apr-07 11:18
Pedro Luz30-Apr-07 11:18 
QuestionError 550: FTP Pin
btsrinath30-Apr-07 9:50
btsrinath30-Apr-07 9:50 
AnswerRe: Error 550: FTP Pin
althamda30-Apr-07 22:45
althamda30-Apr-07 22:45 
QuestionUnhandled Exception - And don't know why Pin
JMOdom30-Apr-07 9:31
JMOdom30-Apr-07 9:31 

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.