Solved

Get string from textfile, then compare it to another string

Posted on 2001-08-10
1
153 Views
Last Modified: 2010-05-18
Hi all!

I have a strange problem. Here's the code.
Private Sub cmdTest_Click()
Open "c:\thomas" For Input As #1 ' file opened for reading
   
    'While Not EOF(1)
        Line Input #1, instring1
        Line Input #1, instring2
        Line Input #1, instring3
        Line Input #1, instring4
        Line Input #1, instring5
    'Wend
Close #1
'MsgBox instring1 & vbCrLf & instring2 & vbCrLf & instring3 & vbCrLf & instring4 & vbCrLf & instring5
scriptlang.RunCommand instring1, instring2, instring3, instring4, instring
End Sub


When I run the sub Scriptlang.RunCommand (here's the code):

Public Sub RunCommand(Command2Run, Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4)        'Runs the command u ask for
    If Command2Run = "RegDelete" Then RegDelete Syntaxx1, Syntaxx2
    If Command2Run = "RegSetKey" Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
    If Command2Run = "FileDelete" Then FileDelete Syntaxx1, Syntaxx2
    If Command2Run = "SendMSG" Then SendMSG Syntaxx1
End Sub

It does not evaluate the string Command2Run to be the same as the one on the other side of the = sign.

When I try to use RegSetKey, the value of instring1 is "RegSetKey", and the value of Command2Run is also "RegSetKey". BUT when it compares the string Command2Run with "RegSetKey" it doesn't think it's the same???!

Please help =)

/Thomas
0
Comment
Question by:thomas77
1 Comment
 
LVL 11

Accepted Solution

by:
Otana earned 100 total points
ID: 6372537
Try this:

If Ucase(Trim(Command2Run)) = Ucase(Trim("RegSetKey")) Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
   
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

919 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

14 Experts available now in Live!

Get 1:1 Help Now