Streamwriter: write two listboxes on the same row

As the error message says, the syntax you attempted is simply not valid. There’s no feature in VB.NET that does that sort of thing.

However, the .NET Framework API does provide a means for something similar, which would probably work in your case. See Enumerable.Zip(). You can use it like this:

Using writer = New StreamWriter(SaveFileDialog1.FileName)
    For Each o As String In Form3.ListBox1.Items.Cast(Of Object).Zip(Form3.ListBox2.Items.Cast(Of Object), Function(x1, x2) x1 & ", " & x2)
End Using

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top