Solved

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

Posted on 2007-11-15
2
289 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

837 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