FAQ: How to Open a URL or Send an E-Mail from a VB Application

I tried for hours and hours to find a good, simple code to make it possible for me to open a URL or send an e-mail from a link edited in a TextBox and not assigned in a LinkLabel. The answer is very simple: Just add the following code to a click event in a button:

Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        System.Diagnostics.Process.Start(TextBox1.Text)
End Sub

The contents of the text box must be http://www.something.com or mailto:info@something.com. Your default browser or mail application will open and perform the requested action.



Comments

  • its not working??

    Posted by eswar_525 on 10/24/2006 11:24am

    hey its not working . i'm using VB 6.0 only. when i copied to try this code. it says Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click System.Diagnostics.Process.Start("http://www.mail.yahoo.com") End Sub the first two lines are in red color means some error is there(i dont know what it is) and when i tried to compile it says "Compiler error: Expected: end of statemnet" what is the problem or how to make it work?? Thanks.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

  • Live Event Date: September 17, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this upcoming eSeminar and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds