Change VB.Net string, so that it works in C#


Can someone help me to change this string, so that it works in C#?

html = "" & _
"<img src=""" & IMAGE_DIRECTORY & Path.GetFileName(s) & """" & _
"height=""" & imgHeight & """ width=""" & imgWidth & """ Border=""0"" name=""image" & intCounter & """>" & _
<br>" & _
"<div align=center><span style=""font size:'7pt'; font-family:'Verdana';"">" & currentImage.Width & "x" & currentImage.Height & "<br>"

In C#, I receive the error "; expected".
thanks a lot!
3/25/2004 10:28:13 AM 91979 articles. 4 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 26

That is one complicated string. Basically, in C#, you "escape" special characters. So, in VB, where you want a quote, you use "" (two quotes in a row). In C# you use \".

I'd also recommend using a Stringbuilder for this instead of so many concatenations. It will be more clear, and more efficient.

MS MVP ASP.NET [VC++/MFC emeritus]

Old Dog Learns New Tricks

Preferred programming language: cuneiform on clay tablets
3/25/2004 1:26:27 PM
Try putting a '@' infront of the string, also convert the double quotes to single quotes within the string.

html= @"a href="'Javascript:ReturnImage('" & Path.GetFileName(s)............";

3/25/2004 1:36:34 PM
thank you!

I use now \" instead ""

html = "<a href=\"Javascript:ReturnImage('" + Path.GetFileName(s) + "')\">";
html += "<img src=\"" + imageDirectory + Path.GetFileName(s) + "\" height=\"" + imgHeight + "\" width=\"" + imgWidth + "\" Border=\"0\" name=\"" + intCounter + "\"></a><br>";
html += "<div align=\"center\"><span style=\"font size:'7pt'; font-family:'Verdana'\">" + currentImgWidth + " x " + currentImgHeight + "<br>";

3/25/2004 2:28:21 PM

Similar Artilces:

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Type.GetType does not work in VB.NET but works in C#. VB.NET gurus Please help
Friends,   I am an experienced C# programmer who is working on a VB.NET project now. I am writing different methods covering the following functionalities 1) Take a datareader as input and return an arraylist of class object2) Take an xmlnode (received from a webservice) as input and return an arraylist of class object. The methods are generic methods which take datareader/xmlnode as first parameter and classname (string) as the second parameter. This way it will work trivially. The schema of class object matches with the input (datareader or xmlnode)In C# I used to do th...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

How to change code to C#.Net ?...
Hi, Earlier i had a class  that i got it from this Forum, it in and i am trying it to convert it in but i am unable to covert properly to work. the functionality of this class is to convert number value to words. i am putting both of code and please rectify it.Public Class NumberToWords Dim Character As String Public Function ConvertNumber(ByVal A As Double) As String On Error Resume Next Dim MM Dim IM ConvertNumber = "" MM = Microsoft.VisualBasic.Len(A) IM = Microsoft.VisualBasic.Left(A, Mic...

converting to from offered me some sample code when I signed up with them the only problem is the sample code is in but my page that they type all of their credit card into is <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage(""); } private String readHtmlPage(string url) { ... vs vs
just out of curiousity which looks, acts most like java? i'm still learning trying to used to but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using now i want to transfer from to so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using The question I have is for someone who knows php would it be better to transition to or Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVP

what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

used a to converter and am now getting a syntax error.
ok I used a cool utility at to convert some to and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

how to get C# and code to work together
we have an application at work that uses code quite a bit... however i only found one article regardnig implementing active directory authentication and authorization written in c# i know its possible, how do i add in the C# code into my existing app? You can compile the C# code into an assembly and add the dll to your bin directory of the VB project and add a reference to it. Or you can just setup a C# project in your VB.NET solution, and set a project reference to it from your VB project. Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered...

Help Me C# is working But Not working
Edited by SomeNewKid. Please post code between <code> and </code> tags. Pls, Help me, It is simple chat programe. My <IFRAME> src is calling the bellow event in C# it is working perfectly. private void Page_Load(object sender, System.EventArgs e) { string sDealer=""; string sWrite=""; if ( Session["Channel"] != null ) sDealer = Session["Channel"].ToString(); Response.Write( "<meta http-equiv=\"Refresh\"content=\"4\">" ); sWrite=MyModule.MyChat.GetAl...

Difference Between VB.Net And C#.Net
 hi friends,Please tell me the key difference between the Vb.Net And C#.Net..wheather supports operator overloading..Thanks & Regards,Pravin Kumar T.   Regards,Pravin Kumar T. pravin_thanusu:Please tell me the key difference between the Vb.Net And C#.Net.. Neither are ASP.NET so you probably want a different forum.  You'll also find your answers at JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.  >Please tell me the k... and same app
Been asked before, but... If I build a c# web app and someone builds a desktop app, can they communicate? and can you develop against my c# web app, can I add the desktop app as a reference? or at least make calls to it? web apps or desktop apps can contain components created in either language. i have a web solution that contains 4 projects. One of the projects is C# the others are VB.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: Thanks...that is what I was looking for ...