G
Guest
help!!
I used StreamReader and StreamWrite.
the problem is it doesn't write all readline.
For example it read 100 line and write 51lines.
this is codes.
class kenlee{
private StreamWriter sw ;
private StreamReader sr;
private String line;
private String SSNO;
private const int SSNO_F = 13, SSNO_L = 21;
private void btnload_Click(object sender, EventArgs e)
{
read();
}
void read()
{
try
{
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (StreamReader SR = new StreamReader(textBox1.Text))
{
Int32 count=0;
SW = new StreamWriter("TestFile.txt");
while ((line = SR.ReadLine()) != null)
{
SSNO=line.Substring(SSNO_F, SSNO_L);
count += 1;
sw.WriteLine("SSNO is : {0}", SSNO);
}
}
////omited
}
I used StreamReader and StreamWrite.
the problem is it doesn't write all readline.
For example it read 100 line and write 51lines.
this is codes.
class kenlee{
private StreamWriter sw ;
private StreamReader sr;
private String line;
private String SSNO;
private const int SSNO_F = 13, SSNO_L = 21;
private void btnload_Click(object sender, EventArgs e)
{
read();
}
void read()
{
try
{
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (StreamReader SR = new StreamReader(textBox1.Text))
{
Int32 count=0;
SW = new StreamWriter("TestFile.txt");
while ((line = SR.ReadLine()) != null)
{
SSNO=line.Substring(SSNO_F, SSNO_L);
count += 1;
sw.WriteLine("SSNO is : {0}", SSNO);
}
}
////omited
}