Solved

How to using server.URLEncode at visual basic 6.0

Posted on 2001-06-02
9
1,383 Views
Last Modified: 2013-11-25
hi
How to using server.URLEncode at visual basic 6.0

thank
0
Comment
Question by:kwq5421
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 6

Expert Comment

by:sharmon
ID: 6149952
If you are making a IIS application it should already be available to you.  If not you may want to look at this function that someone has already written, that will do it for you.  Here is the link...

http://www.planet-source-code.com/xq/ASP/txtCodeId.3229/lngWId.1/qx/vb/scripts/ShowCode.htm
0
 
LVL 1

Author Comment

by:kwq5421
ID: 6150037
Can i using the vbscript server.urlencode at vb source code ? thank ..
0
 
LVL 1

Author Comment

by:kwq5421
ID: 6150051
Can i using the vbscript server.urlencode at vb source code ? thank ..
0
Technology Partners: 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!

 
LVL 1

Author Comment

by:kwq5421
ID: 6150093
Can i using the vbscript server.urlencode at vb source code ? thank ..
0
 
LVL 1

Expert Comment

by:jdunck
ID: 6150741
Server.URLEncode is not part of VBScript.

The Server object is part of ASP...-not- part of VB.

Understand that methods of objects are part of that object, -not- part of the language you happen to be programming in.

ASP can be written in JavaScript just as easily, and COM objects can be used by any language that supports COM (C++, VC++, VB, Java, I think).
0
 
LVL 6

Accepted Solution

by:
sharmon earned 15 total points
ID: 6150895
Add a reference to Microsoft ASP library in your project and it will expose Server, Session, etc...but they will not work unless they are passed from a real Session on a IIS server into your project.  You cannot set them to new objects.  I do not know the reasoning behind it as I have never looked into it.  I haven't ever had a need to use the ASP object library without a IIS Server.  
0
 
LVL 6

Expert Comment

by:andyclap
ID: 6151907
It's not actually a very difficult function, you could write your own along the lines of:

Public Function URLEncode(ByVal s As String) As String

    Dim lLoop As Long
    Dim sC As String

    URLEncode = ""
    For lLoop = 1 To Len(s)
        sC = Mid$(s, lLoop, 1)
        If InStr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", UCase$(sC)) = 0 Then
            If Asc(sC) < 16 Then
                sC = "%0" & Hex$(Asc(sC))
            Else
                sC = "%" & Hex$(Asc(sC))
            End If
        End If
       
        URLEncode = URLEncode & sC
    Next
   
End Function
0
 
LVL 1

Expert Comment

by:jdunck
ID: 6152378
AndyClap --
  Its true that the specs aren't hard to handle, but since the original question was so far off the mark, I was trying to explain what he was really asking.
  Trying to use an ASP-created object as an intrinic property of VB begs for clarification.
0
 
LVL 6

Expert Comment

by:sharmon
ID: 6199533
If you didn't like the responses you had gotten from us so far, you should have requested a deletion of the question or held out for whatever you were looking for.  This is the third time someone I responded who couldn't do what they were asking for and I told them that, and gotten a grade of C for it.  I would have rather not helped you at all.  I don't think I'll be responding to questions that do not have a valid answer anymore.  There were two answers to this, one You Cant Include the ASP Object Library in a VB Stand Alone Application, or write your own replacement function.  You have gotten both of them from me, and another from Andy.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

713 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