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?

Recommended Answers

All 2 Replies

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

If you have got the sollution then plz mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.