Solved

How to using server.URLEncode at visual basic 6.0

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

thank
0
Comment
Question by:kwq5421
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 13 hours left to enroll

627 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