Hey ,
i am trying to make an encryption program . With any codes i've found until now i didn't manage to solve my problem . my problem is about saving my data from a multiline text box to a text file . Basically i want , by clicking on a command button , a txt file to be created and anything i have in my text box to be save on that text file .

ilias_de

Hey ,
i am trying to make an encryption program . With any codes i've found until now i didn't manage to solve my problem . my problem is about saving my data from a multiline text box to a text file . Basically i want , by clicking on a command button , a txt file to be created and anything i have in my text box to be save on that text file .

ilias_de

This code may help you. it creates one word file if it is not exist and then assigns ur textbox value to that file. ITdoes not overwrite the file . If you want to overwrite you have to change the code...
im using rich textbox and creating document called mydoc7.doc in local system and saving richtextbox value in mydoc7.doc.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim arr As String = RichTextBox1.Text
System.IO.File.AppendAllText("c:\mydoc7.doc", arr)


End Sub

This code may help you. it creates one word file if it is not exist and then assigns ur textbox value to that file. ITdoes not overwrite the file . If you want to overwrite you have to change the code...
im using rich textbox and creating document called mydoc7.doc in local system and saving richtextbox value in mydoc7.doc.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim arr As String = RichTextBox1.Text
System.IO.File.AppendAllText("c:\mydoc7.doc", arr)


End Sub

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.