CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2000
    Posts
    2

    how to evaluate expressions

    i got few expressions containing logical "And" ,"Or" .this expressions are in a text file in the following format.
    result=((var1And var2)or(var3 And var4)) etc.The expression can be in any number of "and's & or's".
    i want to use the VB6.0 logical operators to evaluate my expression.
    How will these expression get copied or moved to vb code from the file?
    or How will the operators work within a file?


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: how to evaluate expressions

    you can use the Microsoft Script Control in your VB program.
    It has an Eval method that can evaluate any expression that is passed as a string.


  3. #3
    Join Date
    Feb 2000
    Posts
    2

    Re: how to evaluate expressions

    sir will u please tell in detail how will u do that.
    also please take a note that the string of expressions is in *.txt format


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: how to evaluate expressions

    here is a sample

    private Sub Command1_Click()
    Dim hFile as Integer
    hFile = FreeFile
    Dim strLine as string
    Open "c:\test.txt" for input as #hFile
    Do While Not EOF(hFile)
    Line input #hFile, strLine
    s.ExecuteStatement strLine
    Loop
    Close (hFile)
    End Sub

    contents of test.txt


    msgbox "hello.world"
    msgbox "greetings from the script control"






Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured