Jump to content

Loop problem?


Guest 9thcircle

Recommended Posts

Guest 9thcircle

Ok heres what Ive got right now Ive tried my loop a bunch of different ways but I cant this to work!rp1 = UCase(Text2.Text)rp2 = UCase(Text3.Text)Dim lngResult As LongDim lngStart As LongDim EOF As LongstrFind = rp1EOF = Len(crypt)MStop = EOFlngStart = 1Do While MStop > 0lngResult = InStr(lngStart, crypt, rp1, 1)lngStart = lngResultMid(decrypt, lngStart, 1) = rp2'decrypt = Replace(decrypt, rp1, rp2, lngStart, 1)MStop = MStop - 1LoopWhat im going for is to read from a string to find a variable charecter and replacing that charecter in another string with another variable charecter, then start from that charecter and find the next instance to replace that one and continue to the end of the string.It works, sort of...it replaces the first instance and only the first instance, sometimes, depending on how i try to do my loop it only seems to change the first charecter... well if anyone can help it would be much apreciated... Thank you!

Link to post
Share on other sites
Mid(decrypt, lngStart, 1) = rp2'decrypt = Replace(decrypt, rp1, rp2, lngStart, 1)

in Mid() you're saying the string to check through is "decrypt", yet decrypt is set after that statement, and it's "rem'd" out?oh and i think Mid() needs to be on the other side of the equals sign?----------Adam

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...