locked
Adding Notepad to my project RRS feed

  • Question

  • Hello sir,

    I am using Visual studio 2005

    I am having nearly 1000 of HTML Pages in my project which are viewed by WebBrowser Control. I want to add notes for every HTML pages in a notepad and must be saved within my project folder. 
    I must also be able to edit,delete it.
    And also when i again open the page for which i add notes, i again able to see that notes again.
    Friday, December 12, 2008 1:18 AM

Answers

  • Try this code, let me know if it works for you.
            'Use this in some event to load the related notes file at the same time as the HTML file if one exists.  
            Dim sr As System.IO.StreamReader  
            Dim textFile As String 
     
            textFile = Replace("Your HTML File Path"".html"".txt")  
     
            If System.IO.File.Exists(textFile) Then 
                sr = New System.IO.StreamReader(textFile)  
                'This is a rich text box that you have added on your form.  
                rtxtNotes.text = sr.ReadToEnd  
                sr.Close()  
                sr = Nothing 
            End If 
     
            'Use this to write to your txt file  
            Dim sw As System.IO.StreamWriter  
            Dim textFile As String 
     
            textFile = Replace("Your HTML File Path"".html"".txt")  
     
            sw = New System.IO.StreamWriter(textFileFalse)  
            'This is a rich text box that you have added on your form.  
            sw.Write(rtxtNotes.text)  
            sw.Close()  
            sw = Nothing 
     
     
     
            'Use this to delete your file  
            Dim textFile As String 
     
            textFile = Replace("Your HTML File Path"".html"".txt")  
            If System.IO.File.Exists(textFile) Then 
                System.IO.File.Delete(textfile)  
            End If 
    • Marked as answer by Xingwei Hu Thursday, December 18, 2008 7:48 AM
    Friday, December 12, 2008 4:29 PM