Sunday, February 28, 2010 4:40 PM
Hey I need help in saving the contents of a rich textbox into a batch file. The code that I written save it fines but when I open the batch file it seems to not recognize it as a batch file. Here is the code below:
Dim savefiledialog1 As New SaveFileDialog
savefiledialog1.Title = "Save As Batch File"
savefiledialog1.FileName = ""
savefiledialog1.Filter = "Visual Basic Script|*.bat"
If savefiledialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Catch ex As Exception
Sunday, February 28, 2010 8:01 PMThe SaveFile method a richtextbox saves the file in RTF format, which cannot be understood by the batch file processor. Instead of
Sunday, February 28, 2010 8:15 PM
Sorry It did not work I keep getting an error, saying that overload resolution failed because WriteAllText does not support that many arguments.
Sunday, February 28, 2010 8:23 PMIf you place your cursor at the starting bracket for the method the system will indicate the bit that is missing - you need to indicate wheter or not the existing batch file will be overwritten. Change the line to:
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName(), RichTextBox1.Text, False)
- Marked As Answer by Fatalis Programmer Sunday, February 28, 2010 10:35 PM
Sunday, February 28, 2010 10:34 PMHey thanks for your help I marked you as answer