Click here to Skip to main content
11,922,071 members (65,937 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 4:38am
Edited 26-Nov-12 4:58am
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
Please Sign up or sign in to vote.

Solution 1

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
0 OriginalGriff 578
1 Dave Kreskowiak 285
2 Sergey Alexandrovich Kryukov 173
3 phil.o 160
4 Richard MacCutchan 155
0 OriginalGriff 7,036
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,286
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web02 | 2.8.151120.1 | Last Updated 22 May 2015
Copyright © CodeProject, 1999-2015
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