Solved

I have a problem I want to convert vb code to c# code

Posted on 2007-11-15
2
287 Views
Last Modified: 2012-05-05
Function URLDecode(What)
         Dim Pos, pPos
       What = Replace(What, "+", " ")
         On Error Resume Next
         Dim Stream: Set Stream = CreateObject("ADODB.Stream")
         If Err = 0 Then 'URLDecode using ADODB.Stream, If possible
           On Error GoTo 0
           Stream.Type = 2 'String
           Stream.Open
           Pos = InStr(1, What, "%")
           pPos = 1
           Do While Pos > 0
             Stream.WriteText Mid(What, pPos, Pos - pPos) + _
               Chr(CLng("&H" & Mid(What, Pos + 1, 2)))
             pPos = Pos + 3
             Pos = InStr(pPos, What, "%")
           Loop
           Stream.WriteText Mid(What, pPos)
           Stream.Position = 0
           URLDecode = Stream.ReadText
           Stream.Close
         Else
           On Error GoTo 0
           Pos = InStr(1, What, "%")
           Do While Pos > 0
              What = Left(What, Pos - 1) + _
               Chr(CLng("&H" & Mid(What, Pos + 1, 2))) + _
               Mid(What, Pos + 3)
             Pos = InStr(Pos + 1, What, "%")
           Loop
           URLDecode = What
         End If
         Set Stream = Nothing
        End Function
       
0
Comment
Question by:sitg
2 Comments
 
LVL 1

Accepted Solution

by:
webressurs earned 500 total points
ID: 20298168
I guess there is some errors in your code...
Try this when converting from c# -> vb.net / vb.net -> c#:
http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx
0
 

Author Comment

by:sitg
ID: 20310378
Thanks
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
https://github.com/willowsystems/jSignature 11 46
Hey!! 5 33
Printing 1 50
What is Microsoft.Exchange.WebServices.Data.ExchangeService in PowerShell? 4 23
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now