Hi Jac,
I think you are getting a runtime error
(System.ArgumentOutOfRangeException?) because the count in your append goes
beyond the character position in the string you are trying to append. For
example, in the first Append, the starting position parameter refers to
"R01", not the StringBuilder. You said start at position 1, which is '0'.
You also specified the third parameter to count 3 characters. Well, there
aren't 3 characters from '0' in "R01" -- only two. Since you already know
the text you want to append, you don't need the Append overload you're
using. Try this:
recordline.Append("R01");
BTW, it helps if you provide code that compiles. ;)
Joe
--
http://www.csharp-station.com
"JAc" <JA*@discussions.microsoft.com> wrote in message
news:EC**********************************@microsof t.com...
Hey,
it must be very simple but I am struggeling.
I want to make a simple flat file.
I do now (I also tried with string)
foreach(Object obj in collection)
{
recordline = new StringBuilder();
recordline.Capacity = 200;
recordline.append("R01",1,3);
recordline.append("TEST",4,4);
recordline.append(obj.textfield,8,10);
recordline = recordline + "\n"; // New line is it nessecary?
streamwriterCubic.Writeline(recordline);
}
streamwriterCubic.Close.
It don'work. Receive an error on startindex in append (also when I used
Insert). I also tried with a foreach too fill up the recordline witj 200
blanc's. But I think that is not a good idea. There must be something
simple.
Thanks for showing me the best way.
Jac