CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Posts
    10

    Rich Text Box control

    I have a RTF file which i want to load in a RTF control & display.
    While loading a file I want to insert a header & footer in the RTF file. Since contents of header & footer are not fix, i have to do it at run time. How o I do that ? Has anybody worked on the same ?
    -Sachin


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Rich Text Box control


    private Sub Command1_Click()
    'now choose: or you save the file with all
    'and then you must code to search for your header or your footer and if exist on reloading
    'do not add it again, or you save the
    'file stripping headre and footer.
    'Here I show you the first one
    Const myHeader = "This is my Header"
    Const myFooter = "This is my footerNote"
    'load the file
    rtfBox.FileName = "D:\pota.rtf"
    If rtfBox.Find(myHeader, 0, , rtfWholeWord) = -1 then
    rtfBox.SelStart = len(rtfBox.Text)
    rtfBox.SelLength = 0
    rtfBox.SelText = vbCrLf & vbCrLf & myFooter
    rtfBox.SelStart = 0
    rtfBox.SelLength = 0
    rtfBox.SelText = myHeader & vbCrLf & vbCrLf
    End If
    rtfBox.SaveFile "D:\pota.rtf", rtfRTF
    End Sub




    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured