14,639,650 members
Rate this:
See more:
Dear all,

I have a problem that in my files have data such as
002
Phanny
F
09876789
pkah123
Friday, January 06, 2012
Wednesday, February 01, 2012
Phnom Penh
good
0012
asdf
F
asfd
asdf
Friday, January 06, 2012
Friday, January 06, 2012
asdf
asdf

Then I want to read it to put in the list view such as
ID Name Gender Address Phone Passport StartDate EndDate Description
002 Phanny F Phnom Penh 09876889 pkah123 Friday.. wendesday.. good

Then when It read this finish, when it see the ID, it will enter the new line.

I can do it only in one column as below
002PhannyF09876789pkah123Friday, January 06, 2012Wednesday, February 01, 2012Phnom Penhgood0012asdfFasfdasdfFriday, January 06, 2012Friday, January 06, 2012asdfasdf

this result only in one line and in one column.
My code here:
string file_name = "D:\\AEU\\C# Programming\\TurismMangementSystem\\TurismMangementSystem\\test.txt";
string textLine = "";
do
{

listView1.Items.Add(lis);

Thank you so much.
Posted
Updated 5-Jan-12 16:51pm
v2

http://msdn.microsoft.com/en-us/library/aa287535%28v=vs.71%29.aspx

Rate this:

## Solution 1

Try this and vote:

int counter = 0;
string line;

// Read the file and display it line by line.
{
Console.WriteLine (line);
counter++;
}

file.Close();

// Suspend the screen.
Console.ReadLine();
phanny 2011 5-Jan-12 23:03pm

Sorry I am using Visual Studio 2010, so please write it in Visual.
Thanks

What does it mean -- "in Visual"?! You should understand just a bit what are you asking about.
Get my vote of 1 for the question.
--SA
phanny 2011 5-Jan-12 23:18pm

Microsoft Visual Studio is a software that we can write VB.net or C#.net and ASP.net.

All right. Voted. A 4. You see, the question is simple, but it really worth noting that there are no situations where a hard-coded path name can be useful; and a location like "c:\text.txt" is not really quite legitimate, especially with Windows 7. Some "neutral" variable like fileName, even undeclared (I mean, in a code sample) would do better. I hope I did not offend you with this little note... :-)
--SA
Rate this:

## Solution 2

it looks like you need to read 9 lines to make a record there for this might help

do
int linecount=1
do{
if(linecount % 9 != 0)
{
linecount++;
}
else
{
linecount = 1;
textLine = "";
}
} while (objReader.Peek() != -1);
v2
phanny 2011 6-Jan-12 2:32am

An erro on line