urls in a richtextbox
-
I have the following event handler for a rich text box. Protected Sub Link_Clicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles rtbDescription.LinkClicked Try System.Diagnostics.Process.Start(e.LinkText) Catch ex As Exception Debug.WriteLine(ex.Message & " : " & e.LinkText) End Try End Sub When I click a link in the rich text box nothing happens an I receive the following line in my output. The system cannot find the path specified : http://www.cnn.com/rssclick/2005/TECH/internet/07/28/disappearing.apple.ap/index.html?section=cnn\_tech Anyone have any ideas? MSDN states that this handler should fire the default browser.
-
I have the following event handler for a rich text box. Protected Sub Link_Clicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles rtbDescription.LinkClicked Try System.Diagnostics.Process.Start(e.LinkText) Catch ex As Exception Debug.WriteLine(ex.Message & " : " & e.LinkText) End Try End Sub When I click a link in the rich text box nothing happens an I receive the following line in my output. The system cannot find the path specified : http://www.cnn.com/rssclick/2005/TECH/internet/07/28/disappearing.apple.ap/index.html?section=cnn\_tech Anyone have any ideas? MSDN states that this handler should fire the default browser.
Try it like this:
Dim proc As New Process()
With proc
.StartInfo.FileName = e.LinkText
.StartInfo.UseShellExecute = True
.Start()
End WithI would appear that Process is not using Shell Execute for some reason, so, force it to do so. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Try it like this:
Dim proc As New Process()
With proc
.StartInfo.FileName = e.LinkText
.StartInfo.UseShellExecute = True
.Start()
End WithI would appear that Process is not using Shell Execute for some reason, so, force it to do so. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
I have modified my code as you suggested, yet I get the same response. The system cannot find the path specified : http://www.cnn.com/rssclick/2005/WORLD/africa/07/28/niger.nomads.email.ap/index.html?section=cnn\_tech Protected Sub Link_Clicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles rtbDescription.LinkClicked Try Dim proc As New Process() With proc .StartInfo.FileName = e.LinkText .StartInfo.UseShellExecute = True .Start() End With 'System.Diagnostics.Process.Start(e.LinkText.ToString) Catch ex As Exception Debug.WriteLine(ex.Message & " : " & e.LinkText) End Try End Sub
-
I have modified my code as you suggested, yet I get the same response. The system cannot find the path specified : http://www.cnn.com/rssclick/2005/WORLD/africa/07/28/niger.nomads.email.ap/index.html?section=cnn\_tech Protected Sub Link_Clicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles rtbDescription.LinkClicked Try Dim proc As New Process() With proc .StartInfo.FileName = e.LinkText .StartInfo.UseShellExecute = True .Start() End With 'System.Diagnostics.Process.Start(e.LinkText.ToString) Catch ex As Exception Debug.WriteLine(ex.Message & " : " & e.LinkText) End Try End Sub
I have no idea what's going on. That's very same code works perfectly for me. Perhaps this registry key is screwed up? -> HKEY_CLASSES_ROOT\http. You might want to check to see if anything is registered under http\Shell\Open\Command. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome