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

[494 byte] By [Xi0N] at [2007-12-24]
# 1

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.

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2
I get the error "type StringBuilder is not defined"
Maybe i am importing wrong?
Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3
you need to import the System.Text.StringBuilder namespace, at the top of your class
ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 4
Sorry for being so noob, but, how do i do so? (im starting with .net)

Thanks

Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 5

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"

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 6
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.......

Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 7

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

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 8
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
Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 9

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());

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 10
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 ;)

Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 11

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

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 12
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.... ;)
Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 13

no worries, its a learning curve.

Has the problem been resolved?

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 14
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

Xi0N at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...