How to close the currently selected tab and rtf file that is loaded into the Rich Text Box?

Posted on 2005-04-10
Last Modified: 2010-04-23
I need to be able to close the currently selected tab by clicking a button on my toolbar.  
Not sure how to do it.  
I will post my code if you want.
Question by:jettman26
    LVL 12

    Expert Comment

    assuming it's the same program from before...



    As for closing the RTF... you just need to check before removing whether the user wants to save or not, and use your save methods (that you already have, if they click yes)

    Author Comment

    Thanks, that worked.  
    For another 125 points, with my program (Same one as before) how can I be able to click on a hyperlink and it will launch a browser?
    Right now it shows up as a hyperlink but when I click on it, it does nothing.

    Author Comment

    I think the following should work but there is no richtextBox click event that I can find.

    1) Set your RichTextBox1.DetectUrls to True
    2)add the codes below

    Private Sub richTextBox1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles richTextBox1.LinkClicked
    End Sub
    LVL 12

    Accepted Solution

    if your current line is like this...

    Dim activeRTB As RichTextBoxPrintCtrl.RichTextBoxPrintCtrl.RichTextBoxPrintCtrl

    change it to:

    Dim WithEvents activeRTB As RichTextBoxPrintCtrl.RichTextBoxPrintCtrl.RichTextBoxPrintCtrl


    then add this sub

       Sub linkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles activeRTB.LinkClicked
             Dim p As New Process
            p.StartInfo.FileName = e.LinkText
    End Sub
        End Sub

    Author Comment

    Thanks a bunch.  Hopefully I can get you up to #1 in points by myself!

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now