Help with exporting text and formating vb.net tia sal

G

Guest

Greetings all

I'm trying to export text to a file but the format comes out incorrectly
I'm trying to have an array exported to a text file side by side
Example
Name:
John Doe Jane Doe Sally Joe
45 no address 12 no address 78 has address
123-123-4345 123-233-1234 342-342-2342

The problem is that I can't get the arraylist to come out side by side why is this?
see code below

Dim LineValues() As String
Dim sw As New StreamWriter("v:\test.txt")
Dim counter As Integer
Dim c As New ArrayList

If ComboBox1.Visible = True Then
lboElements.Items.Add(name1.Text & address1.Text & number1.Text)
lboElements.Items.Add(name2.Text & address2.Text & number2.Text)
With c
.Add(name1.Text & Chr(10) &address1.Text & number1.text)
.Add(name2.Text & Chr(10) & address2.Text & number2.text)
End With
For counter = 0 To c.Count() - 1
LineValues = CType(c(counter), String())
MessageBox.Show(LineValues(0))
'Call sw.WriteLine(text1(0) & " - " & text1(1))
Next
sw.Close()
MessageBox.Show("saved")
 
C

Cor Ligthert

Sal,

Why you use the arraylist in this.
It has no function.

However lets assume that it is a sample to show the problem than the only
thing you have to change is when I see all things right that
LineValues = CType(c(counter), String())
MessageBox.Show(LineValues(0))
'Call sw.WriteLine(text1(0) & " - " & text1(1))
\\\
sw.WriteLine(c(counter).ToString)
///
And why you are using the With clause, you type now 13 characters (including
the spaces) where you need without it only 2. In my opinion does it not make
your program more readable.

I hope this helps?

Cor


What you want is in my opinion not more than this.
 
Top