Solved

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

Posted on 2007-11-15
2
282 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

15 Experts available now in Live!

Get 1:1 Help Now