Click here to Skip to main content
12,699,351 members (32,787 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
I want to convert this code from c# to vb language in ASP.net.What is the expression of this code if I will write it to vb.

enter code here
`protected void btnPreview_Click(object sender, EventArgs e)
{
    Session["ImageBytes"] = PhotoUpload.FileBytes;
    ImagePreview.ImageUrl = "~/ImageHandler.ashx";
}`
Posted 18-Feb-13 6:16am
Updated 18-Feb-13 6:18am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

There are lots of free converters, few are:
Convert C# to VB.NET [^]
Convert C# to VB.NET2[^]
Code Translation for .NET [^]
Convert VB to C# or C# to VB[^]
Try it yourself!
  Permalink  
Comments
Sergey Alexandrovich Kryukov 18-Feb-13 14:16pm
   
Good (my 5), but it is all on the Web?
I strongly recommend open-source ILSpy, to be independent from all sites/services.
Please see my answer.
—SA
Farzanatayeb 18-Feb-13 22:39pm
   
It works,thank you for your solution.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

ILSpy can be used as the open-source desktop code converter:
http://ilspy.net/[^].

The best thing is that you won't be dependent on any sites or services. This software has a lot more uses; this is an open-source replacement for the famous Reflector:
http://en.wikipedia.org/wiki/.NET_Reflector[^].

[EDIT]

This is how to use it for translation: having some C# code, compile it into any assembly. Load this assembly with ILSpy from a file (such as .DLL, .EXE…), locate the code you are interested in. For output language, select VB.NET. When you disassemble the code, it will be shown in VB.NET. Same thing to get C# from VB.NET.

—SA
  Permalink  
v2
Comments
Sandeep Mewara 19-Feb-13 1:53am
   
Interesting. Thanks for sharing. Good to know about it. My 5!


My only doubt is if OP can use it by himself to do a VB <-> C#
   
Thank you, Sandeep.
(By the way, you did not actually vote.)
It was Espen Harlinn who first advised this utility. I use it these days, built from source. Not bad at all.
—SA
Sandeep Mewara 19-Feb-13 1:59am
   
A delayed 5 actually. You saw my comment instantly! :)

About tool, a thank you token is on the way to Espen too. :)
   
Certainly.
Thank you, Sandeep.
—SA
   
By the way, you are right: it's better to explain the usage. I just did it, after [EDIT].
And I recently found that ILSpy can be used as a decent debugger. Impressive, considering that you can do it without having source code. You can even attach to already executing process...
—SA
Sandeep Mewara 19-Feb-13 2:10am
   
Thats good to know. I will try to have a look at it when I get some time, you have made it 'definitely use' category tool. :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Go here for a language converter:

Click[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100