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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...