Results 1 to 2 of 2

Thread: Nifty re-calc selstart routine needed

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    46

    Nifty re-calc selstart routine needed

    problem is simple bit somewhat cumbersome to explain

    . user has a textbox containing a string
    . user serially selects portions of the the string and click 'set'
    . portions selected are tucked into an array where their info is stored (selLentgh, selText, selStart and more)

    problem: textbox vbCrLf's the string if it is long enough - and this is ok, I want multiline - but: I cant seem to find a dynamic algorithm to strip the original big string from vbCrLf, and then re-calc the selStart values for the portions selected. this must be done before I start operating on the string portions put in the array.

    I've figured this much -

    . find how many / if any vbCrLf are in the string BEFORE the portion selected's selStart-value. decrease selStart-value by NumberOfVBCRLF * 2 (since vbCrLf is two chars) to arrive at the new selStart value for the portion.
    . check whether the selected portions contain vbCrLf, if so decrease selLength value with the same formula as above.

    I just can't seem to write it in code! regards everybody /lumen

  2. #2
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    You can replace the string part you get with vbcrlf stripped out of them

    try this in the emidiate pane
    VB Code:
    1. amy = "aa" & vbcrlf & " bb"  'press enter
    2. ?amy ' press enter
    3.  
    4. amy = replace (amy,vbcrlf," ") 'press enter
    5. ?amy'press enter
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

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