translation of a little script from VB to C sharp pls

I want the script bellow in C# pls:

"<SCRIPT LANGUAGE=""JScript"">" & vbCrLf & " function fnAdd(){" & vbCrLf & "document.body.insertAdjacentHTML('BeforeEnd','<P>' +document.getElementById('oText') + '</P>');}" & vbCrLf & "</SCRIPT>"

I especially have a problem converting both the quotation marks and the VbCrLf when they re in the same string

Thanks a lot




Answer this question

translation of a little script from VB to C sharp pls

  • Larry.Dugger

    try this:

    "<Script laguage=\"Jscript\">function fnAdd() { document.body.insertAdjecentHTML('BeforeEnd','<P>' + document.getElementById('oText') + '</P>'); }</script>"



  • Webbert

    How do we translate vbCrLf to C# pls

  • scottre

    as stated:

    Environment.NewLine

    or

    \r\n



  • Newbie Kam

    VBCrlf is a carriage return I believe which is Environment.NewLine

    \ is known as an escape character meaning that if you just do a " it will block of the entire line as a string since "" is an indication of a string/text to be included in there. if you do a \" then it tells C# that it should not "close off" the string but keep it and place the quote in the string itself



  • hypo

    And you might find this handy :-)

    http://www.carlosag.net/Tools/CodeTranslator/Default.aspx

    Good luck!



  • Valst

    In the code suggested above: 2 questions pls:

    How about vbCrLf which I included in the Vb code

    and what does \ that Ahmed included in : \"Jscript\" replace. what does it stand for.

    Thanks guys.



  • translation of a little script from VB to C sharp pls