Advertisement

09.08.2006 at 06:06AM PDT, ID: 21982447
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.0

VBScript StrComp not working

Asked by YZlat in Web Languages/Standards

Tags: ,

I am using VBScript and trying to compare two variables - one coming from a text file and another one entered through a textbox:

iCompare = StrComp(Trim(strClient), Trim(ClientID), 1)

iCompare always return -1

what is the problem?

here is my function:

Function FindClient(ClientID)
Dim strClient,strClientLine,strValue,strTextoutput, arrClient, arrText

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile("C:\mytext.txt", 1)

strText= oFile.ReadAll
arrText=Split(strText," ")
 for each strClientLine in arrText
      if Trim(strClientLine) <> "" then
                arrClient = Split(strClientLine, "=")
                strClient=arrClient(0)
MsgBox(strClient & " and input=" & ClientID)
iCompare = StrComp(Trim(strClient), Trim(ClientID), 1)
MsgBox("compare value is " & iCompare)
                if iCompare=0 then
                      strValue=arrClient(1)
                      ''write strValue to another file
         MsgBox(strValue)
                    output=True
                else
                    ''clientID not found
                  output=false
                end if
      end if
Next

oFile.Close
FindClient= output
End Function

here are the contents of my text file:

AC1111=value1
34MN78=value2
KB7894=value3
TESTING=value4
HH9999=value5


I input value 34MN78 into a text boxStart Free Trial
[+][-]09.08.2006 at 07:16PM PDT, ID: 17484155

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2006 at 07:38PM PDT, ID: 17484213

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Web Languages/Standards
Tags: vbscript, strcomp
Sign Up Now!
Solution Provided By: acperkins
Participating Experts: 2
Solution Grade: C
 
 
[+][-]09.08.2006 at 07:39PM PDT, ID: 17484214

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.11.2006 at 06:27AM PDT, ID: 17494293

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.11.2006 at 07:35AM PDT, ID: 17494881

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32