Click here to Skip to main content
12,456,128 members (52,712 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# MS-Excel Data
Hai guys..

I'm build intarface for detection size object.
I get result the size object from binary image from camera capture and i need record size object data to excel.

I was tried this code to show and record size data from my interface using excel.
private void dataToolStripMenuItem_Click(object sender, EventArgs e)
        {
                Microsoft.Office.Interop.Excel.Application xla = new Microsoft.Office.Interop.Excel.Application();
                Workbook wb = xla.Workbooks.Add(XlSheetType.xlWorksheet);
                Worksheet ws = (Worksheet)xla.ActiveSheet;
 
                xla.Visible = true;
 
                ws.Cells[1, 1] = "No";
                ws.Cells[1, 2] = "Size Data";
                
                string[] arraySize;
                arraySize = new string[101];
 
                for (int i = 3; i != (arraySize.Length); i++)
                {
                    string sizeData = labelSize.Text;
                    ws.Cells[i, 2] = sizeData;
                }

But code above just give me "one data" when i clicked button data and it's still same until rows 100.
And it doesn't what i meant.
I need the size object from the text box in intraface will record to excel when i'm click the button data, and excel give me result size data in runtime from interface.
So, anyone can help me to get runtime size data and record it to excel?
Posted 26-Nov-12 3:38am
Updated 26-Nov-12 3:58am
v2
Comments
Krunal R 26-Nov-12 9:53am
   
What code man ???
zaenal arifin 26-Nov-12 10:02am
   
i have edited my question..
digimanus 29-Nov-12 4:57am
   
i != (arraySize.Length is always true you mean
i < (arraySize.Length
zaenal arifin 4-Dec-12 9:30am
   
Thank you digimanus, for your respon.. :)

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v2
Comments
zaenal arifin 26-Nov-12 10:01am
   
Thank you Krunal for the link.. :)
Krunal R 26-Nov-12 10:03am
   
:)
Krunal R 26-Nov-12 10:08am
   
Have you rejected the solution ??
zaenal arifin 26-Nov-12 10:24am
   
I'm so sorry Krunel, the link can't solve my problem coz i'm not using data grid view in my project..can you give me some advice from my code?it's that right or wrong?
Krunal R 26-Nov-12 10:28am
   
Oh, I thought that just because of current forum issue, Answer has been rejected..
So here I have updated my solution.. take a look at that.. perhaps that could help you ...
zaenal arifin 27-Nov-12 8:51am
   
Thank you Krunal.. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 22 May 2015
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100