Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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