Open default email program (Outlook, for example) when pressing a link

Hello all, iu have a question:
My app has some labels with email adresses, what i want to do is some kind of linklabel but instad of oppening an internet adress, i want it to open, for example, outlook, with the adress in the destination field (many programs does so), also, it would be fine if i can personalize a default email subject and text, but if i can open the program and put the adress i am already happy enough :)

Thanks

Sorry i didnt specify, i am programming in Visual .NET


Answer this question

Open default email program (Outlook, for example) when pressing a link

  • Ravi Sharma

    Well, actually i am using sharp develop, but it should be the same, no (Maybe we went out of the topic, sorry), do you recommend me using visualstudio 2005 instead
    thanks

  • Adam Plocher

    no worries, its a learning curve.

    Has the problem been resolved



  • TannerH

    Sorry for being so noob, but, how do i do so (im starting with .net)

    Thanks

  • Racsco

    you are using VB.NET correct

    remember to make sure that you have entered the correct name of the class etc.. by using Intellisense.

    my code looks like this:

    Imports System.Threading

    Imports System.Collections

    Imports System.Text.StringBuilder

    Imports System.Diagnostics

     

    public class Form1

     

    private sub button1_click(byval sender as system.object, byval e as System.eventargs) handles button1.Click

      

    dim theStringBuilder as new StringBuilder()

    theStringBuilder.Append("email@somewhere.com")

    theStringBuilder.Append("&subject=my subject")

    theStringBuilder.Append("&body=my email body message")

     

    Process.Start(theStringBuilder.ToString())

     

    end sub

     

    end class



  • day10

    Well, i am completely sure that i am using visual basic .net , as this is the only language i know :) Actually, i know Visual6, (It would be funny if i know c++ and i didnt know it before :) ) but i started porting my apps to vb.net, as they look nicer and looks more stable and safe than the pervious versions, also is an up-to-date language.....
    Im almost sure that phe problem is the neviroment, because when i import the System.Text.StringBuilder , the auto-complete feature recognises this item.. anyway, nvm, and thanks again, and sorry for driving you a bit mad.... ;)

  • wpm

    you need to know what language you are using

    Visual Studio.NET is a development environment which has VB.NET/C#/VC++.NET - a range of .NET language to choose from to develop your application.

    The code I have given now is for both VB.NET and C#

    the VB.NET code supplied earlier will work as I have tested it myself. Give it a shot :-)

    Please post back with the language you are using to develop this application



  • pangitko79

    No, i didnt fix it yet, anyway, my class is started like this:

    Public Partial Class MainForm

    and not

    public class Form1

    Maybe that is the reason why is not working

    Thanks

  • NoEgo

    hehe no worries.

    in your code, scroll right to the top of the file/page. There you should see a bunch of imports..... declarations.

    something like:

    Imports System.Data

    Imports System.Net.Sockets

    Imports System.Net ......

    at the end of one, just add on a new line "imports System.Text.StringBuilder"



  • Chips_in

    I dont know what i am doing wrong, before i asked you how to import because i thought i was doing something wrong.. from the begginning i was importing it like that, in the top of the code typing

    imports System.Text.StringBuilder

    (I have no more imports)
    But i still dont get that type as a known one.......

  • Pockey

    I get the error "type StringBuilder is not defined"
    Maybe i am importing wrong

  • god_rr

    so you are using C# Well its a different language and the incorrect forum to post in :-)

    C# code:

     



    System.Text.StringBuilder theStringBuilder = new System.Text.StringBuilder();
     
    theStringBuilder.Append("email@somewhere.com");
    theStringBuilder.Append("&subject=my subject");
    theStringBuilder.Append("&body=my email body message");
     
    System.Diagnostics.Process.Start(theStringBuilder.ToString());
     

     



  • RPKJBP

    try this:

    //import the system.diagnostics namespace

    dim theStringBuilder as new StringBuilder()

    theStringBuilder.Append("email@somewhere.com")

    theStringBuilder.Append("&subject=my subject")

    theStringBuilder.Append("&body=my email body message")

    Process.Start(theStringBuilder.ToString())

    this will start up the default email client (outlook usually) with the field populated.



  • Bill Cumming

    No,no, im pretty sure i am using vb.net (dont get confused by the program name).

    Ok, anyway, i will try with visual studio, i can guess that might be the problem why i have this issue... if you have another suggestion about which developement enviroment to use, tell me.

    Finally the topic went completely twisted, sorry.. i am porting my apps from vb6 to .net, and i am a bit lost.

    Thanks again ;)

  • Shepherd_85

    you need to import the System.Text.StringBuilder namespace, at the top of your class

  • Open default email program (Outlook, for example) when pressing a link