Text File Contents into 2 Columns.

TwoWing

Well-known member
Joined
Jan 6, 2006
Messages
71
Location
Near Portsmouth, England
Programming Experience
Beginner
Hi. I have a text file with contents. I can print them off in a single column. I can display them one at a time with MessageBox.Show. But what I want to do is to put them into two columns. The first item into the left-hand column and the second into the right-hand one. Then the third into the left and the 4th into the right: and so on. Preferably, I would like to put them into a ListView.
Basically, what I am trying to achieve is an index of a book to which I can add or delete. So, if anyone knows of a way using dotNET to do this I would be pleased to know.
Thanks in advance.:)
 
Text File contents into 2 columns.

What I did is this:
To put text file into ListView:
VB.NET:
objListItem = lvwLog.Items.Add(data)
data = sR.ReadLine()
 
objListItem.SubItems.Add(data)
data = sR.ReadLine

Then, printing in 2 columns, I did this:
VB.NET:
e.Graphics.DrawString(line,Brushes. .......etc)
x+= 200
e.Graphics.DrawString(line,Brushes.........etc)
x-= 200
y=lineheight
It may not be the recognised way, but I just tried it as an experiment, and it worked. If there is another way, I would be pleased to have it.
Cheers.
 
Back
Top