Results 1 to 5 of 5

Thread: Can anyone help me with strings?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123

    Post

    Here is the question!

    ok if txtinput.text = 2+(4/(2*6))
    would this statement return that the value of strtemp = (4/(2*6))

    strCalc = txtInput.Text
    intCurpos = InStr(intCurpos, "(", strCalc, vbTextCompare)
    Do
    intTempLastPar = intLastPar
    intLastPar = InStr(intLastPar, ")", strCalc, vbTextCompare)
    Loop Until InStr(intLastPar, ")", strCalc, vbTextCompare) = 0
    strTemp = strCalc - Left$(strCalc, intCurpos - 1) - Right$(strCalc, intLastPar + 1)
    MsgBox strTemp



    [This message has been edited by ravcam (edited 01-08-2000).]

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    Make a textbox and say texttest.text = strtemp. then you'll know.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123

    Post

    I did but I keep getting compiler errors! In my code and don't know what is wrong!

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    if intCurpos = 0 then you will get an error in the InStr function

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123

    Post

    Thank you Clunietp but that was not my problem but. I did find a way to to do it if anyone wants to compare this code to that above!

    strCalc = txtInput.Text
    intCurpos = InStr(intCurpos, strCalc, "(", vbTextCompare)
    Do
    intTempPar = intPar
    intPar = InStr(intPar + 1, strCalc, ")", vbTextCompare)
    Loop Until intPar = 0
    strTemp = Mid(strCalc, intCurpos, intTempPar - intCurpos + 1)


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