Hi,
I am using a listview to store items in windows application.Items are displaying in listview,i have used arraylist to store items.But it is storing when the application is running.once if i close the application,the values are being erased.I need to display atleast 10 items in listview when it is opened.so I want to store the items in a txt file and i want to retrieve from txt file.Is it possible?give me sample
Loading
Niradhip ChakrabortyPosted May 21, 2009, 9:45 AM
Hi,
If you want to use textfile,then read the data from it like below.
StreamReader strrr;strrr.Close();..//////////////////////////////////streamreader is nothing but file pointer.and here iused the stream reader to read the data from the textfile(.txt) and displaying that it is in a label.System.IO.this is the name space required to dealwith the files. To read a text file we need to createthe instance of the object,StreamReaderThe instance will be the file pointer for us.Once we have a File Pointer,we need to invoke the method,OpenText method of the object,File. The method, OpenText takes a string as an argument.The string is nothing but the path of file that is going to get created.Niradhip ChakrabortyPosted May 21, 2009, 8:59 AM