array question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NuB

    array question

    I'm passing in an array and I need to write them to a text file. I'm getting
    the data in fine but instead of writing it all to one file it generates a
    seperate file for each item. How can I put each item onto the same file.


    comes in like
    BMW Lexus Chevy Saab

    and its generating a file for
    BMW Lexux Chevy Sabb

    I need all of these on the same file


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: array question

    NuB,

    Can you show the code you are using? It would seem you probably are
    initializing your file stream (or file writer) in a loop, and creating a new
    one through each iteration?

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "NuB" <CSharpCoder> wrote in message
    news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...[color=blue]
    > I'm passing in an array and I need to write them to a text file. I'm
    > getting the data in fine but instead of writing it all to one file it
    > generates a seperate file for each item. How can I put each item onto the
    > same file.
    >
    >
    > comes in like
    > BMW Lexus Chevy Saab
    >
    > and its generating a file for
    > BMW Lexux Chevy Sabb
    >
    > I need all of these on the same file
    >[/color]


    Comment

    • NuB

      #3
      Re: array question

      I've tried this and its not working 100%
      it either gives me the last record or just generates a file for each one.
      now i'm generating an excel sheet on the fly. I have it working in one app,
      but that it reading a file directly, now I need to pass in the information
      and its causing me some pain. Its either giving me the last record passed
      in, or generating an file for each record.


      for (int i = 1; i <= carMake.length; i++)
      {
      newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
      x+=1;
      }

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
      message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...[color=blue]
      > NuB,
      >
      > Can you show the code you are using? It would seem you probably are
      > initializing your file stream (or file writer) in a loop, and creating a
      > new one through each iteration?
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "NuB" <CSharpCoder> wrote in message
      > news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...[color=green]
      >> I'm passing in an array and I need to write them to a text file. I'm
      >> getting the data in fine but instead of writing it all to one file it
      >> generates a seperate file for each item. How can I put each item onto the
      >> same file.
      >>
      >>
      >> comes in like
      >> BMW Lexus Chevy Saab
      >>
      >> and its generating a file for
      >> BMW Lexux Chevy Sabb
      >>
      >> I need all of these on the same file
      >>[/color]
      >
      >[/color]


      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: array question

        NuB,

        You still aren't showing the code that you are using to generate a file.
        What you are showing is just something that increments the value in ranges.


        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m

        "NuB" <CSharpCoder> wrote in message
        news:OeAGz0FaFH A.3840@tk2msftn gp13.phx.gbl...[color=blue]
        > I've tried this and its not working 100%
        > it either gives me the last record or just generates a file for each one.
        > now i'm generating an excel sheet on the fly. I have it working in one
        > app, but that it reading a file directly, now I need to pass in the
        > information and its causing me some pain. Its either giving me the last
        > record passed in, or generating an file for each record.
        >
        >
        > for (int i = 1; i <= carMake.length; i++)
        > {
        > newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
        > x+=1;
        > }
        >
        > "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
        > in message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...[color=green]
        >> NuB,
        >>
        >> Can you show the code you are using? It would seem you probably are
        >> initializing your file stream (or file writer) in a loop, and creating a
        >> new one through each iteration?
        >>
        >> Hope this helps.
        >>
        >>
        >> --
        >> - Nicholas Paldino [.NET/C# MVP]
        >> - mvp@spam.guard. caspershouse.co m
        >>
        >> "NuB" <CSharpCoder> wrote in message
        >> news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...[color=darkred]
        >>> I'm passing in an array and I need to write them to a text file. I'm
        >>> getting the data in fine but instead of writing it all to one file it
        >>> generates a seperate file for each item. How can I put each item onto
        >>> the same file.
        >>>
        >>>
        >>> comes in like
        >>> BMW Lexus Chevy Saab
        >>>
        >>> and its generating a file for
        >>> BMW Lexux Chevy Sabb
        >>>
        >>> I need all of these on the same file
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • NuB

          #5
          Re: array question

          how about this: this is generating the new file
          // instance of excel
          Excel.Applicati on newExcel= new Excel.Applicati on();
          Excel.Workbook newWorkBook=
          excelApp.Workbo oks.Add(XlWBATe mplate.xlWBATWo rksheet);
          Excel._Workshee t carSales = (Excel._Workshe et)
          excelBook.Works heets.get_Item( 1);

          try
          {

          //allow the user to see it the spreadsheet once genertated
          excelApp.Visibl e = true;
          carSales.Column s.ColumnWidth = 21.71;
          //create headers in the columns
          carSales.get_Ra nge("A1",missin g).Value2 = "Car Make";
          carSales.get_Ra nge("A1",missin g).Font.Bold = true;
          carSales.get_Ra nge("B1",missin g).Value2 = "VIN Number";

          //get each record being passed in
          start on the 3rd row of the spreadsheet
          x = 3;
          for (int i = 1; i <= carMake.length; i++)
          {
          carSales.get_ra nge("A" + x.ToString(),mi ssing).Value2 =
          carMake;
          //go to next row if applicable
          x+=1;
          }
          }
          catch (Excpetion ex)
          {

          }






          "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
          message news:%23xgKE%23 FaFHA.2128@TK2M SFTNGP14.phx.gb l...[color=blue]
          > NuB,
          >
          > You still aren't showing the code that you are using to generate a
          > file. What you are showing is just something that increments the value in
          > ranges.
          >
          >
          > --
          > - Nicholas Paldino [.NET/C# MVP]
          > - mvp@spam.guard. caspershouse.co m
          >
          > "NuB" <CSharpCoder> wrote in message
          > news:OeAGz0FaFH A.3840@tk2msftn gp13.phx.gbl...[color=green]
          >> I've tried this and its not working 100%
          >> it either gives me the last record or just generates a file for each one.
          >> now i'm generating an excel sheet on the fly. I have it working in one
          >> app, but that it reading a file directly, now I need to pass in the
          >> information and its causing me some pain. Its either giving me the last
          >> record passed in, or generating an file for each record.
          >>
          >>
          >> for (int i = 1; i <= carMake.length; i++)
          >> {
          >> newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
          >> x+=1;
          >> }
          >>
          >> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
          >> in message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...[color=darkred]
          >>> NuB,
          >>>
          >>> Can you show the code you are using? It would seem you probably are
          >>> initializing your file stream (or file writer) in a loop, and creating a
          >>> new one through each iteration?
          >>>
          >>> Hope this helps.
          >>>
          >>>
          >>> --
          >>> - Nicholas Paldino [.NET/C# MVP]
          >>> - mvp@spam.guard. caspershouse.co m
          >>>
          >>> "NuB" <CSharpCoder> wrote in message
          >>> news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...
          >>>> I'm passing in an array and I need to write them to a text file. I'm
          >>>> getting the data in fine but instead of writing it all to one file it
          >>>> generates a seperate file for each item. How can I put each item onto
          >>>> the same file.
          >>>>
          >>>>
          >>>> comes in like
          >>>> BMW Lexus Chevy Saab
          >>>>
          >>>> and its generating a file for
          >>>> BMW Lexux Chevy Sabb
          >>>>
          >>>> I need all of these on the same file
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • Nicholas Paldino [.NET/C# MVP]

            #6
            Re: array question

            NuB,

            This can't be doing it, as there is no call to save the file.


            --
            - Nicholas Paldino [.NET/C# MVP]
            - mvp@spam.guard. caspershouse.co m

            "NuB" <CSharpCoder> wrote in message
            news:ej%23hbFGa FHA.3320@TK2MSF TNGP12.phx.gbl. ..[color=blue]
            > how about this: this is generating the new file
            > // instance of excel
            > Excel.Applicati on newExcel= new Excel.Applicati on();
            > Excel.Workbook newWorkBook=
            > excelApp.Workbo oks.Add(XlWBATe mplate.xlWBATWo rksheet);
            > Excel._Workshee t carSales = (Excel._Workshe et)
            > excelBook.Works heets.get_Item( 1);
            >
            > try
            > {
            >
            > //allow the user to see it the spreadsheet once genertated
            > excelApp.Visibl e = true;
            > carSales.Column s.ColumnWidth = 21.71;
            > //create headers in the columns
            > carSales.get_Ra nge("A1",missin g).Value2 = "Car Make";
            > carSales.get_Ra nge("A1",missin g).Font.Bold = true;
            > carSales.get_Ra nge("B1",missin g).Value2 = "VIN Number";
            >
            > //get each record being passed in
            > start on the 3rd row of the spreadsheet
            > x = 3;
            > for (int i = 1; i <= carMake.length; i++)
            > {
            > carSales.get_ra nge("A" + x.ToString(),mi ssing).Value2 =
            > carMake;
            > //go to next row if applicable
            > x+=1;
            > }
            > }
            > catch (Excpetion ex)
            > {
            >
            > }
            >
            >
            >
            >
            >
            >
            > "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
            > in message news:%23xgKE%23 FaFHA.2128@TK2M SFTNGP14.phx.gb l...[color=green]
            >> NuB,
            >>
            >> You still aren't showing the code that you are using to generate a
            >> file. What you are showing is just something that increments the value in
            >> ranges.
            >>
            >>
            >> --
            >> - Nicholas Paldino [.NET/C# MVP]
            >> - mvp@spam.guard. caspershouse.co m
            >>
            >> "NuB" <CSharpCoder> wrote in message
            >> news:OeAGz0FaFH A.3840@tk2msftn gp13.phx.gbl...[color=darkred]
            >>> I've tried this and its not working 100%
            >>> it either gives me the last record or just generates a file for each
            >>> one.
            >>> now i'm generating an excel sheet on the fly. I have it working in one
            >>> app, but that it reading a file directly, now I need to pass in the
            >>> information and its causing me some pain. Its either giving me the last
            >>> record passed in, or generating an file for each record.
            >>>
            >>>
            >>> for (int i = 1; i <= carMake.length; i++)
            >>> {
            >>> newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
            >>> x+=1;
            >>> }
            >>>
            >>> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
            >>> in message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...
            >>>> NuB,
            >>>>
            >>>> Can you show the code you are using? It would seem you probably are
            >>>> initializing your file stream (or file writer) in a loop, and creating
            >>>> a new one through each iteration?
            >>>>
            >>>> Hope this helps.
            >>>>
            >>>>
            >>>> --
            >>>> - Nicholas Paldino [.NET/C# MVP]
            >>>> - mvp@spam.guard. caspershouse.co m
            >>>>
            >>>> "NuB" <CSharpCoder> wrote in message
            >>>> news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...
            >>>>> I'm passing in an array and I need to write them to a text file. I'm
            >>>>> getting the data in fine but instead of writing it all to one file it
            >>>>> generates a seperate file for each item. How can I put each item onto
            >>>>> the same file.
            >>>>>
            >>>>>
            >>>>> comes in like
            >>>>> BMW Lexus Chevy Saab
            >>>>>
            >>>>> and its generating a file for
            >>>>> BMW Lexux Chevy Sabb
            >>>>>
            >>>>> I need all of these on the same file
            >>>>>
            >>>>
            >>>>
            >>>
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            • NuB

              #7
              Re: array question

              because i'm not saving it, its generated on the fly, the user sees it and
              they can do whatever they want, close it after, save it, print, etc.


              "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
              message news:%23G7ipLGa FHA.2736@TK2MSF TNGP12.phx.gbl. ..[color=blue]
              > NuB,
              >
              > This can't be doing it, as there is no call to save the file.
              >
              >
              > --
              > - Nicholas Paldino [.NET/C# MVP]
              > - mvp@spam.guard. caspershouse.co m
              >
              > "NuB" <CSharpCoder> wrote in message
              > news:ej%23hbFGa FHA.3320@TK2MSF TNGP12.phx.gbl. ..[color=green]
              >> how about this: this is generating the new file
              >> // instance of excel
              >> Excel.Applicati on newExcel= new Excel.Applicati on();
              >> Excel.Workbook newWorkBook=
              >> excelApp.Workbo oks.Add(XlWBATe mplate.xlWBATWo rksheet);
              >> Excel._Workshee t carSales = (Excel._Workshe et)
              >> excelBook.Works heets.get_Item( 1);
              >>
              >> try
              >> {
              >>
              >> //allow the user to see it the spreadsheet once genertated
              >> excelApp.Visibl e = true;
              >> carSales.Column s.ColumnWidth = 21.71;
              >> //create headers in the columns
              >> carSales.get_Ra nge("A1",missin g).Value2 = "Car Make";
              >> carSales.get_Ra nge("A1",missin g).Font.Bold = true;
              >> carSales.get_Ra nge("B1",missin g).Value2 = "VIN Number";
              >>
              >> //get each record being passed in
              >> start on the 3rd row of the spreadsheet
              >> x = 3;
              >> for (int i = 1; i <= carMake.length; i++)
              >> {
              >> carSales.get_ra nge("A" + x.ToString(),mi ssing).Value2 =
              >> carMake;
              >> //go to next row if applicable
              >> x+=1;
              >> }
              >> }
              >> catch (Excpetion ex)
              >> {
              >>
              >> }
              >>
              >>
              >>
              >>
              >>
              >>
              >> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
              >> in message news:%23xgKE%23 FaFHA.2128@TK2M SFTNGP14.phx.gb l...[color=darkred]
              >>> NuB,
              >>>
              >>> You still aren't showing the code that you are using to generate a
              >>> file. What you are showing is just something that increments the value
              >>> in ranges.
              >>>
              >>>
              >>> --
              >>> - Nicholas Paldino [.NET/C# MVP]
              >>> - mvp@spam.guard. caspershouse.co m
              >>>
              >>> "NuB" <CSharpCoder> wrote in message
              >>> news:OeAGz0FaFH A.3840@tk2msftn gp13.phx.gbl...
              >>>> I've tried this and its not working 100%
              >>>> it either gives me the last record or just generates a file for each
              >>>> one.
              >>>> now i'm generating an excel sheet on the fly. I have it working in one
              >>>> app, but that it reading a file directly, now I need to pass in the
              >>>> information and its causing me some pain. Its either giving me the last
              >>>> record passed in, or generating an file for each record.
              >>>>
              >>>>
              >>>> for (int i = 1; i <= carMake.length; i++)
              >>>> {
              >>>> newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
              >>>> x+=1;
              >>>> }
              >>>>
              >>>> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om>
              >>>> wrote in message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...
              >>>>> NuB,
              >>>>>
              >>>>> Can you show the code you are using? It would seem you probably
              >>>>> are initializing your file stream (or file writer) in a loop, and
              >>>>> creating a new one through each iteration?
              >>>>>
              >>>>> Hope this helps.
              >>>>>
              >>>>>
              >>>>> --
              >>>>> - Nicholas Paldino [.NET/C# MVP]
              >>>>> - mvp@spam.guard. caspershouse.co m
              >>>>>
              >>>>> "NuB" <CSharpCoder> wrote in message
              >>>>> news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...
              >>>>>> I'm passing in an array and I need to write them to a text file. I'm
              >>>>>> getting the data in fine but instead of writing it all to one file it
              >>>>>> generates a seperate file for each item. How can I put each item onto
              >>>>>> the same file.
              >>>>>>
              >>>>>>
              >>>>>> comes in like
              >>>>>> BMW Lexus Chevy Saab
              >>>>>>
              >>>>>> and its generating a file for
              >>>>>> BMW Lexux Chevy Sabb
              >>>>>>
              >>>>>> I need all of these on the same file
              >>>>>>
              >>>>>
              >>>>>
              >>>>
              >>>>
              >>>
              >>>[/color]
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • Nicholas Paldino [.NET/C# MVP]

                #8
                Re: array question

                NuB,

                Well, that's the case then. Instead of creating a new instance of
                Excel.Applicati on every time that function is called, you have to store the
                reference and then set the values on sheet in the reference of the
                application you store.


                --
                - Nicholas Paldino [.NET/C# MVP]
                - mvp@spam.guard. caspershouse.co m

                "NuB" <CSharpCoder> wrote in message
                news:Og05hOGaFH A.3536@TK2MSFTN GP10.phx.gbl...[color=blue]
                > because i'm not saving it, its generated on the fly, the user sees it and
                > they can do whatever they want, close it after, save it, print, etc.
                >
                >
                > "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
                > in message news:%23G7ipLGa FHA.2736@TK2MSF TNGP12.phx.gbl. ..[color=green]
                >> NuB,
                >>
                >> This can't be doing it, as there is no call to save the file.
                >>
                >>
                >> --
                >> - Nicholas Paldino [.NET/C# MVP]
                >> - mvp@spam.guard. caspershouse.co m
                >>
                >> "NuB" <CSharpCoder> wrote in message
                >> news:ej%23hbFGa FHA.3320@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
                >>> how about this: this is generating the new file
                >>> // instance of excel
                >>> Excel.Applicati on newExcel= new Excel.Applicati on();
                >>> Excel.Workbook newWorkBook=
                >>> excelApp.Workbo oks.Add(XlWBATe mplate.xlWBATWo rksheet);
                >>> Excel._Workshee t carSales = (Excel._Workshe et)
                >>> excelBook.Works heets.get_Item( 1);
                >>>
                >>> try
                >>> {
                >>>
                >>> //allow the user to see it the spreadsheet once genertated
                >>> excelApp.Visibl e = true;
                >>> carSales.Column s.ColumnWidth = 21.71;
                >>> //create headers in the columns
                >>> carSales.get_Ra nge("A1",missin g).Value2 = "Car Make";
                >>> carSales.get_Ra nge("A1",missin g).Font.Bold = true;
                >>> carSales.get_Ra nge("B1",missin g).Value2 = "VIN Number";
                >>>
                >>> //get each record being passed in
                >>> start on the 3rd row of the spreadsheet
                >>> x = 3;
                >>> for (int i = 1; i <= carMake.length; i++)
                >>> {
                >>> carSales.get_ra nge("A" + x.ToString(),mi ssing).Value2 =
                >>> carMake;
                >>> //go to next row if applicable
                >>> x+=1;
                >>> }
                >>> }
                >>> catch (Excpetion ex)
                >>> {
                >>>
                >>> }
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
                >>> in message news:%23xgKE%23 FaFHA.2128@TK2M SFTNGP14.phx.gb l...
                >>>> NuB,
                >>>>
                >>>> You still aren't showing the code that you are using to generate a
                >>>> file. What you are showing is just something that increments the value
                >>>> in ranges.
                >>>>
                >>>>
                >>>> --
                >>>> - Nicholas Paldino [.NET/C# MVP]
                >>>> - mvp@spam.guard. caspershouse.co m
                >>>>
                >>>> "NuB" <CSharpCoder> wrote in message
                >>>> news:OeAGz0FaFH A.3840@tk2msftn gp13.phx.gbl...
                >>>>> I've tried this and its not working 100%
                >>>>> it either gives me the last record or just generates a file for each
                >>>>> one.
                >>>>> now i'm generating an excel sheet on the fly. I have it working in one
                >>>>> app, but that it reading a file directly, now I need to pass in the
                >>>>> information and its causing me some pain. Its either giving me the
                >>>>> last record passed in, or generating an file for each record.
                >>>>>
                >>>>>
                >>>>> for (int i = 1; i <= carMake.length; i++)
                >>>>> {
                >>>>> newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
                >>>>> x+=1;
                >>>>> }
                >>>>>
                >>>>> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om>
                >>>>> wrote in message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...
                >>>>>> NuB,
                >>>>>>
                >>>>>> Can you show the code you are using? It would seem you probably
                >>>>>> are initializing your file stream (or file writer) in a loop, and
                >>>>>> creating a new one through each iteration?
                >>>>>>
                >>>>>> Hope this helps.
                >>>>>>
                >>>>>>
                >>>>>> --
                >>>>>> - Nicholas Paldino [.NET/C# MVP]
                >>>>>> - mvp@spam.guard. caspershouse.co m
                >>>>>>
                >>>>>> "NuB" <CSharpCoder> wrote in message
                >>>>>> news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...
                >>>>>>> I'm passing in an array and I need to write them to a text file. I'm
                >>>>>>> getting the data in fine but instead of writing it all to one file
                >>>>>>> it generates a seperate file for each item. How can I put each item
                >>>>>>> onto the same file.
                >>>>>>>
                >>>>>>>
                >>>>>>> comes in like
                >>>>>>> BMW Lexus Chevy Saab
                >>>>>>>
                >>>>>>> and its generating a file for
                >>>>>>> BMW Lexux Chevy Sabb
                >>>>>>>
                >>>>>>> I need all of these on the same file
                >>>>>>>
                >>>>>>
                >>>>>>
                >>>>>
                >>>>>
                >>>>
                >>>>
                >>>
                >>>[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • NuB

                  #9
                  Re: array question

                  and thats my question how would i do that?

                  "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
                  message news:%23spABdGa FHA.2128@TK2MSF TNGP14.phx.gbl. ..[color=blue]
                  > NuB,
                  >
                  > Well, that's the case then. Instead of creating a new instance of
                  > Excel.Applicati on every time that function is called, you have to store
                  > the reference and then set the values on sheet in the reference of the
                  > application you store.
                  >
                  >
                  > --
                  > - Nicholas Paldino [.NET/C# MVP]
                  > - mvp@spam.guard. caspershouse.co m
                  >
                  > "NuB" <CSharpCoder> wrote in message
                  > news:Og05hOGaFH A.3536@TK2MSFTN GP10.phx.gbl...[color=green]
                  >> because i'm not saving it, its generated on the fly, the user sees it and
                  >> they can do whatever they want, close it after, save it, print, etc.
                  >>
                  >>
                  >> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
                  >> in message news:%23G7ipLGa FHA.2736@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
                  >>> NuB,
                  >>>
                  >>> This can't be doing it, as there is no call to save the file.
                  >>>
                  >>>
                  >>> --
                  >>> - Nicholas Paldino [.NET/C# MVP]
                  >>> - mvp@spam.guard. caspershouse.co m
                  >>>
                  >>> "NuB" <CSharpCoder> wrote in message
                  >>> news:ej%23hbFGa FHA.3320@TK2MSF TNGP12.phx.gbl. ..
                  >>>> how about this: this is generating the new file
                  >>>> // instance of excel
                  >>>> Excel.Applicati on newExcel= new Excel.Applicati on();
                  >>>> Excel.Workbook newWorkBook=
                  >>>> excelApp.Workbo oks.Add(XlWBATe mplate.xlWBATWo rksheet);
                  >>>> Excel._Workshee t carSales = (Excel._Workshe et)
                  >>>> excelBook.Works heets.get_Item( 1);
                  >>>>
                  >>>> try
                  >>>> {
                  >>>>
                  >>>> //allow the user to see it the spreadsheet once genertated
                  >>>> excelApp.Visibl e = true;
                  >>>> carSales.Column s.ColumnWidth = 21.71;
                  >>>> //create headers in the columns
                  >>>> carSales.get_Ra nge("A1",missin g).Value2 = "Car Make";
                  >>>> carSales.get_Ra nge("A1",missin g).Font.Bold = true;
                  >>>> carSales.get_Ra nge("B1",missin g).Value2 = "VIN Number";
                  >>>>
                  >>>> //get each record being passed in
                  >>>> start on the 3rd row of the spreadsheet
                  >>>> x = 3;
                  >>>> for (int i = 1; i <= carMake.length; i++)
                  >>>> {
                  >>>> carSales.get_ra nge("A" + x.ToString(),mi ssing).Value2 =
                  >>>> carMake;
                  >>>> //go to next row if applicable
                  >>>> x+=1;
                  >>>> }
                  >>>> }
                  >>>> catch (Excpetion ex)
                  >>>> {
                  >>>>
                  >>>> }
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om>
                  >>>> wrote in message news:%23xgKE%23 FaFHA.2128@TK2M SFTNGP14.phx.gb l...
                  >>>>> NuB,
                  >>>>>
                  >>>>> You still aren't showing the code that you are using to generate a
                  >>>>> file. What you are showing is just something that increments the value
                  >>>>> in ranges.
                  >>>>>
                  >>>>>
                  >>>>> --
                  >>>>> - Nicholas Paldino [.NET/C# MVP]
                  >>>>> - mvp@spam.guard. caspershouse.co m
                  >>>>>
                  >>>>> "NuB" <CSharpCoder> wrote in message
                  >>>>> news:OeAGz0FaFH A.3840@tk2msftn gp13.phx.gbl...
                  >>>>>> I've tried this and its not working 100%
                  >>>>>> it either gives me the last record or just generates a file for each
                  >>>>>> one.
                  >>>>>> now i'm generating an excel sheet on the fly. I have it working in
                  >>>>>> one app, but that it reading a file directly, now I need to pass in
                  >>>>>> the information and its causing me some pain. Its either giving me
                  >>>>>> the last record passed in, or generating an file for each record.
                  >>>>>>
                  >>>>>>
                  >>>>>> for (int i = 1; i <= carMake.length; i++)
                  >>>>>> {
                  >>>>>> newSheet.get_ra nge("A" + x.ToString(),mi ssing).Value2 = carMake;
                  >>>>>> x+=1;
                  >>>>>> }
                  >>>>>>
                  >>>>>> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om>
                  >>>>>> wrote in message news:u27VBsFaFH A.2884@tk2msftn gp13.phx.gbl...
                  >>>>>>> NuB,
                  >>>>>>>
                  >>>>>>> Can you show the code you are using? It would seem you probably
                  >>>>>>> are initializing your file stream (or file writer) in a loop, and
                  >>>>>>> creating a new one through each iteration?
                  >>>>>>>
                  >>>>>>> Hope this helps.
                  >>>>>>>
                  >>>>>>>
                  >>>>>>> --
                  >>>>>>> - Nicholas Paldino [.NET/C# MVP]
                  >>>>>>> - mvp@spam.guard. caspershouse.co m
                  >>>>>>>
                  >>>>>>> "NuB" <CSharpCoder> wrote in message
                  >>>>>>> news:O1pO0cFaFH A.2984@TK2MSFTN GP15.phx.gbl...
                  >>>>>>>> I'm passing in an array and I need to write them to a text file.
                  >>>>>>>> I'm getting the data in fine but instead of writing it all to one
                  >>>>>>>> file it generates a seperate file for each item. How can I put each
                  >>>>>>>> item onto the same file.
                  >>>>>>>>
                  >>>>>>>>
                  >>>>>>>> comes in like
                  >>>>>>>> BMW Lexus Chevy Saab
                  >>>>>>>>
                  >>>>>>>> and its generating a file for
                  >>>>>>>> BMW Lexux Chevy Sabb
                  >>>>>>>>
                  >>>>>>>> I need all of these on the same file
                  >>>>>>>>
                  >>>>>>>
                  >>>>>>>
                  >>>>>>
                  >>>>>>
                  >>>>>
                  >>>>>
                  >>>>
                  >>>>
                  >>>
                  >>>[/color]
                  >>
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  Working...