• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

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

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.
0
jettman26
Asked:
jettman26
  • 3
  • 2
1 Solution
 
S-TwilleyCommented:
assuming it's the same program from before...

TabControl1.TabPages.Remove(TabControl1.SelectedTab)

===================

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)
0
 
jettman26Author Commented:
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.
0
 
jettman26Author Commented:
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
System.Diagnostics.Process.Start(e.LinkText)
End Sub
 
0
 
S-TwilleyCommented:
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
        p.Start()
End Sub
        MsgBox(e.LinkText)
    End Sub
0
 
jettman26Author Commented:
Thanks a bunch.  Hopefully I can get you up to #1 in points by myself!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now