Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a read-only RTF file in a EULA form

Status
Not open for further replies.

jimoblak

Instructor
Oct 23, 2001
3,620
US
I probably have 10 hours of experience with Visual Basic 2005 Express Edition so please excuse my ignorance.

I need to mock up an existing RTF file in a license agreement form. I have dropped the RichTextBox control on the form but I am lost where to embed the source RTF file. Can someone explain or point me to a good online resource? I've already got all the accept/deny form buttons and read-only attributes for the textbox set with no problem. I only seem to be able to paste plain text as the control's text attribute.
 
Hello!

Usually the EULAs, agreement, licenses etc come visible to the user during the installation process. That's where the select "I agree" or "I accept" and so on. Do you want the RTF file to appear in a setup project?

(
In Express edition only the clickonce deployment is available. You can try an other setup project, i mean 3rd party, like the which is very good.
)
 
This software does not use an installer. It runs from a CD. The first run presents the EULA and then writes the user preference/input to a temp directory so that the EULA is not presented again on another run of the app.

I'm not really inquiring about installers. I just would like to know how to display read-only RTF text in a form.
 
RichTextBox and TextBox controls have a 'ReadOnly' property. Just set it to true.
 
Thanks - but again - I already have read-only attributes set with no problem.

My issue is with attaching the RTF file data to this RichTextBox control. How do I embed the external .RTF file's data? It seems that I can only type in plain text into the 'text' attribute. Is this a limitation of the Express version?

Perhaps my question is being misunderstood because this task is too simple and I will smack my forhead when I realize how easily it is done.
 
Hello!

Try this:

Code:
        Dim executing_assembly As System.Reflection.Assembly = Reflection.Assembly.GetEntryAssembly()

        Dim my_namespace As String = executing_assembly.GetName().Name.ToString()

        Dim text_stream As Stream = executing_assembly.GetManifestResourceStream(my_namespace _
                   + ".EULADocument.rtf")   '<--- a text file example
        If Not (text_stream Is Nothing) Then
            Dim stream_reader As New StreamReader(text_stream)

            RichTextBox1.Rtf = stream_reader.ReadToEnd()

            stream_reader.Close()
        End If

NOTE:
1. The file i load is "EULADocument.rtf"
2. Copy it (your file) and paste it in the solution explorer.
3. Change the build action to "Embedded Resource
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top