473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Write an array from textbox to a textf file

Hi dear BYTES members :
I have a probelm when writting in a text file i have a string
of 14 numbers and they change evey time with a space between them but the probelm every time it erase the previous line and write a new one until i find only the last line in the text file :( plz help me
the c# code :
Expand|Select|Wrap|Line Numbers
  1. string path = @"D:\newS_R.txt";
  2.  
  3.                 TextWriter tw = new StreamWriter(path);
  4.                 tw.WriteLine(textBox46.Text + " " + textBox45.Text + " " + textBox44.Text + " " + textBox43.Text + " " + textBox42.Text + " " + textBox41.Text + " " + textBox40.Text + " " + textBox39.Text + " " + textBox38.Text + " " + textBox37.Text + " " + textBox33.Text + " " + textBox34.Text + " " + textBox35.Text + " " + textBox36.Text + "" + Environment.NewLine);
  5.                 tw.Close();
Jun 18 '11 #1
2 2162
MrWoff
2
Expand|Select|Wrap|Line Numbers
  1. tw.WriteLine(
  2. textBox46.Text + " " + textBox
  3. 45.Text + " " + textBox44.Text
  4.  + " " + textBox43.Text +
  5.  " " + textBox42.Text + "
  6.  " + textBox41.Text + " "
  7.  + textBox40.Text + " " +
  8.  textBox39.Text + " " + t
  9. extBox38.Text + " " + textBox3
  10. 7.Text + " " + textBox33.Text&
  11. nbsp;+ " " + textBox34.Text +&
  12. nbsp;" " + textBox35.Text + "&
  13. nbsp;" + textBox36.Text + "\n");
Jun 18 '11 #2
kosaks
10
Hello

try this. add "true" as a second parameter in your TextWriter class.

TextWriter tw = new StreamWriter(path,true);

Im not sure of this but i think it will work. It will append your text file. instead of erasing the old text in it, it will just add a new line to the text file.

Regards
Jun 28 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Jeevan | last post by:
Hi, I have some data which I am getting from a socket. I am currently storing the data in an array (so that future reading of the data will be fast as it will be in RAM instead of hard disk)....
9
by: steph_de_marseille | last post by:
I would like to write a x array in a file. If the array has a small numbers of columns I know I can use a loop like: int i,j; double array; FILE *file1; file1=fopen("data.dat","w");...
2
by: tim | last post by:
i have an array of bytes which i write to a binary file seems to me the only way is to write one element at a time, which takes *forever is there a way to write the entire array to the binary...
14
by: Niron kag | last post by:
Hello ! With c# , I want to write to a text file in a specific font and color. Any ideas ? Thanks...
0
by: Bahaa Hany | last post by:
that the code i wrote FileStream w = new FileStream("d:\\HufmanCompression.txt",FileMode.Create); BinaryWriter writer = new BinaryWriter(w); for (i = 0; i <...
0
by: sandhyamn | last post by:
hi....i am writing a jsp code for uploading file inside a folder using multipart/form-data.but also i want to write textbox values in to that file, but the textbox values is not coming. ie..textbox...
1
by: sandhyamn | last post by:
hi...i am trying to write a programme for uploading file with jsp using multipart/form data.it's working.....but the problem is i can't write the textbox values into a file....if change the form...
9
mageswar005
by: mageswar005 | last post by:
Hi Guys, My array textbox validation is not working fine,my code is given below please help me immediately. function validation() { var chks =...
5
by: stoogots2 | last post by:
I have written a windows application that performs several functions (is multi threaded). I have a Textbox in the main window of the app which I want to display the contents of the logfile and...
0
by: naivewisdom | last post by:
For a lengthy program which would be in no way helpful to discribe, I need to populate a three dementional array from a file and overwrite the file with the modefied arraylist later. The three...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.