Results 1 to 3 of 3

Thread: concatenate

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    concatenate

    Hi,
    I would like to convert this C# code to VB.NET

    /////C#//////////
    errorMessage += "\n\n Page location: " + context.Request.RawUrl;
    errorMessage += "\n\n Message: " + ex.Message;
    errorMessage += "\n\n Source: " + ex.Source;
    errorMessage += "\n\n Method: " + ex.TargetSite;
    errorMessage += "\n\n Statck Trace: " + ex.StackTrace;


    Converted it to VB.NET as below
    errorMessage &= ControlChars.Lf & ControlChars.Lf & " Page location: " & context.Request.RawUrl
    errorMessage &= ControlChars.Lf & ControlChars.Lf & " Message: " & ex.Message
    errorMessage &= ControlChars.Lf & ControlChars.Lf & " Source: " & ex.Source
    ????????? errorMessage &= ControlChars.Lf & ControlChars.Lf & " Method: " & ex.TargetSite
    errorMessage &= ControlChars.Lf & ControlChars.Lf & " Statck Trace: " & ex.StackTrace

    BUT there is an error on line 4 indicated by ????????????
    It says operator '&' is not defined for types string and system.reflection.MethodBase

    Any thoughts please?
    Thanks

  2. #2
    Lively Member darktown's Avatar
    Join Date
    Apr 2006
    Posts
    85

    Re: concatenate

    Use "+" instead of "&"
    errorMessage +=
    There is an easy way, there is a hard way and there is My way of doing things!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    Re: concatenate

    Hi,
    The problem was that I had to use .ToString()

    Thanks for looking at this issue.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width