Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 
Problem With Mailto Start Process (Tuesday, January 03, 2006)



Found the following interesting discussion in the Newsgroups:

Problem With Mailto Start Process
by:Wayne Wengert

I am using a Sub (see below) to call the default mail application and pass a
list of email addresses and a subject. Most of the time this works perfectly
but occasionally I get an error ("System NullReferenceException: Object
reference not set to an instance of an object"). From what I've been able to
determine, this occurs when there is a username (left of the @) with a
period such as joe.smith@somesite.com). Has anyone seen this type of problem
and have suggestions on how to resolve it?

================ Code =====================
Public Sub StartDefaultMail( _

ByVal [To] As String, _

Optional ByVal Subject As String = "" _

)

Try

Dim psi As New ProcessStartInfo

psi.UseShellExecute = True

psi.FileName = _



Process.Start(psi)

Catch ex As Exception

MsgBox("Exception: " & ex.ToString, MsgBoxStyle.Information, "Error")

Throw _

New Exception( _


ex _

)

End Try

End Sub


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 

Is it possible to get the callstack for the exception?

--
Herfried K. Wagner [MVP]


 Reply:
by:Wayne Wengert

 Herfried;

Is this what you need?

at Microsoft.Win32.NativeMethods.ShellExecuteEx(ShellExeuteInfo info)
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startinfo)
at System.Diagnostic.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at OfficeApp.Module1.StartDefaultNail(String To, String Subject) in c:\2005
myProjects\TestApp2\Module1.vb:line 100

Wayne


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 

Yes, but I still don't have an idea.

2005 -- are you using VS 2005 (CTP?)?
--
Herfried K. Wagner [MVP]


 Reply:
by:Wayne Wengert

 Nope - VS Net 2003

Wayne



Posted by Xander Zelders



0 Comments:

Post a Comment

<< Home

 
Previous Posts
    - Comboboxes in windows forms datagrid
    - Sometimes I want to skip a page - How to do that
    - FxCop Error on command button
    - How to scroll down on listView (programmatically)
    - Open a file save as byte
    - How to add a property to an inherited tool?
    - Retrieve Domain Names
    - listView + events
    - RTC and VB.NET
    - How to change an image?



Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland