Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27203

VS 2010 [RESOLVED] Writing to multiple .txt files

$
0
0
Hey Guys,

What i'm trying to do is write to individual .txt files depending if a string is found from items in a listbox.

code:

Code:

            For Each itm As String In listBoxMain.Items

                '// PLATFORM #1
                If (itm.Contains("string1") Or itm.Contains("string2")) Then

                    Using SW As New StreamWriter("save\" & "Strings12.txt", True)

                        SW.WriteLine("Found - " & itm)

                    End Using

                ElseIf (itm.Contains("string3")) Then

                    Using SW As New StreamWriter("save\" & "Strings3.txt", True)

                        SW.WriteLine("Found - " & itm)

                    End Using

                End If

            Next

So far only the first .txt file is being saved, my logic must be skewed lol

any help would be appreciated :)

cheers guys

Graham

Viewing all articles
Browse latest Browse all 27203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>