Click here to Skip to main content
15,918,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: Working with Decimals Pin
CPallini30-May-08 3:39
mveCPallini30-May-08 3:39 
GeneralRe: Working with Decimals Pin
Jim Warburton30-May-08 4:27
Jim Warburton30-May-08 4:27 
AnswerRe: Working with Decimals Pin
buchstaben30-May-08 3:40
buchstaben30-May-08 3:40 
GeneralRe: Working with Decimals Pin
Jim Warburton30-May-08 4:26
Jim Warburton30-May-08 4:26 
QuestionDotNet Remoting : Event Listner not working in Client App Pin
moobo30-May-08 2:40
moobo30-May-08 2:40 
AnswerRe: DotNet Remoting : Event Listner not working in Client App Pin
Bert delaVega30-May-08 4:47
Bert delaVega30-May-08 4:47 
QuestionHelp with Excel Pin
MumbleB30-May-08 2:06
MumbleB30-May-08 2:06 
AnswerRe: Help with Excel Pin
parth.p30-May-08 2:28
parth.p30-May-08 2:28 
Kwagga wrote:
objRange = objSheet.get_Range("A2", System.Reflection.Missing.Value);



Kwagga wrote:
objRange = objSheet.get_Range("B2", System.Reflection.Missing.Value);



This is what you're doing wrong. You are selecting same cell in loop, so you will get different value from nomread but it will write in same cell.

There are two ways you can write values to excel cell. One is using two dimensional array which would look something like yourArray[2,2] and you would send that to your excel worksheet. But in your code it seems like you don't know the max number or cells you will need. So for something like this you can use Array and Column index to write array.

The code will looks something like this:-
int iR, iC;
iR = 1;//Worksheet RowIndex
iC = 1;//Worksheet ColumnIndex


foreach (ReadFile nomread in res)
{
        //in this you will work direct with worksheet.
        objSheet.Cells[iR, iC] = nomread.CLIENTSURNAME;
        objSheet.Cells[iR, iC+1] = nomread.CLIENTFORENAMES;

        iC = 1; //So your next column will start from 1 which will be A
        iR++; //increment row index by 1 as well.

}


I haven't tested this code so you may need to make some changes. But the point is you should get an idea from this...

- Stop thinking in terms of limitations and start thinking in terms of possibilities -

GeneralRe: Help with Excel Pin
MumbleB30-May-08 2:44
MumbleB30-May-08 2:44 
GeneralRe: Help with Excel Pin
parth.p30-May-08 2:47
parth.p30-May-08 2:47 
GeneralRe: Help with Excel Pin
MumbleB30-May-08 2:52
MumbleB30-May-08 2:52 
GeneralRe: Help with Excel Pin
parth.p30-May-08 2:53
parth.p30-May-08 2:53 
GeneralRe: Help with Excel Pin
MumbleB30-May-08 3:19
MumbleB30-May-08 3:19 
GeneralRe: Help with Excel Pin
parth.p30-May-08 3:39
parth.p30-May-08 3:39 
Questionavi to mpeg conversion in C# Pin
DeepOceans30-May-08 1:53
DeepOceans30-May-08 1:53 
AnswerRe: avi to mpeg conversion in C# Pin
carbon_golem30-May-08 2:25
carbon_golem30-May-08 2:25 
Questionthis application has failed to start because the application configuration [modified] Pin
neyerMat30-May-08 1:44
neyerMat30-May-08 1:44 
QuestionProblem to show PrintPreview with WebBrowser. Pin
hdv21230-May-08 1:31
hdv21230-May-08 1:31 
QuestionFiltering a typed datatable problem Pin
blakey40430-May-08 0:17
blakey40430-May-08 0:17 
AnswerRe: Filtering a typed datatable problem Pin
Rob Smiley30-May-08 5:25
Rob Smiley30-May-08 5:25 
GeneralRe: Filtering a typed datatable problem Pin
blakey40430-May-08 7:51
blakey40430-May-08 7:51 
GeneralRe: Filtering a typed datatable problem Pin
blakey40430-May-08 7:57
blakey40430-May-08 7:57 
GeneralRe: Filtering a typed datatable problem Pin
Rob Smiley30-May-08 8:56
Rob Smiley30-May-08 8:56 
AnswerRe: Filtering a typed datatable problem Pin
blakey40430-May-08 12:59
blakey40430-May-08 12:59 
QuestionReading word formatting in C# Pin
kindzal29-May-08 23:00
kindzal29-May-08 23:00 

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.