operator & not supported

G

Guest

When I code the following
dim s as string = vbcr & vbc
Catch ex As Exceptio
MsgBox(ex.Message & s & ex.HelpLink & s & ex.StackTrace

The message prints out fine, except the HelpLink doesn't appear.

But when I include the following in the msgbox
MsgBox(ex.Message & s & ex.HelpLink & s & ex.StackTrace & s & ex.Source & s & ex.TargetSite
I get the message

Operator & is not defined for types 'string' and 'system.reflection.methodbase

Could somebody explain this to me.

Also, is there a property or method that would give me the 'name' of the exception

polynomial5d
 
G

Guest

The ex.TargetSite is not a string, it is a System.Reflection.MethodBase object, and as such cannot be added to your message box output. Depening on what you want to achieve in your message box output, try looking at the methods of the MethodBase (probably Name and DeclaringType) to see what information can be displayed as a string

Also, you can get the 'name' of an Exception using ex.GetType.ToString - assuming by name you mean something like System.ArgumentException

HT

RS
 
G

Guest

Thank you for your answer Mr. Nerd. I'll post if it does the trick for me

polynomial5d
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top