At the moment I open a html file into a RTB, when I save it I use the code below but this only saves it as a text file with a Html extension I want it to be saved as an Html file.
VB.NET:
Dim strExt As String
strExt = System.IO.Path.GetExtension(currentFile)
strExt = strExt.ToUpper()
Select Case strExt
Case ".RTF"
rtbText.SaveFile(currentFile, RichTextBoxStreamType.RichText)
Case ".DOC"
' Copy the contents of the Richtextbox to the clipboard and keep it's formating
Clipboard.SetText(rtbText.Rtf, TextDataFormat.Rtf)
objWord = CreateObject("Word.Application")
objTempDoc = objWord.Documents.Add
With objTempDoc
.Content.Paste()
.Activate()
.Save()
End With
objWord.Quit()
Case Else
Dim txtWriter As System.IO.StreamWriter
txtWriter = New System.IO.StreamWriter(currentFile)
txtWriter.Write(rtbText.Text)
txtWriter.Close()
txtWriter = Nothing
rtbText.SelectionStart = 0
rtbText.SelectionLength = 0
End Select