0
Dim sw As StreamWriter
        Try
            sw = File.AppendText(CurDir() & "\deskimages.txt")
            sw.Write(TextBox1.Text & " " & TextBox2.Text)
            sw.Flush()
        Catch exc As Exception
            MsgBox(exc.Message)
        Finally
            If Not sw Is Nothing Then
                sw.Close()
            End If
        End Try
        Dim tw As IO.TextWriter
        tw = System.IO.File.CreateText(CurDir() & "\profiles2\" & TextBox1.Text & " " & TextBox2.Text & ".txt")
        tw.WriteLine(TextBox1.Text)
        tw.WriteLine(TextBox2.Text)
        tw.WriteLine(TextBox3.Text)
        tw.WriteLine(ComboBox1.SelectedItem)
        tw.WriteLine(ComboBox2.SelectedItem)
        tw.WriteLine(TextBox4.Text)
        tw.Dispose()
        tw.Close()
        Me.Close()

I don't get what isn't working...it's supposed to add a line to the deskimages.txt and then after wards, create another text file somewhere else and write data to it. But it says the deskimages.text is in use. Any help?

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Pgmer
0

Wow I'm an idiot. It was reading it but not closing on another form. Thanks anyways!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.