Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code 2

Status
Not open for further replies.

DUF

Technical User
Mar 10, 2001
107
IE
I'am new to VB6 and need help.
I want to enter up to 5 Numbers into a Text Box and when that Box has Lost focus it will convert the numbers into characters from the word "INSCRUTABX".
as in : I=1,N=2,S=3,C=4,R=5,U=6,T=7,A=8,B=9,X=0
I am not sure how to go about this and would apreciate any help i just started VB6.

thanks

Duf
 
O.K. I'll give it a brief whirl.

Code:
Public Function MatchNumber(strInput As String) As String

    Dim Idx As Long

    For Idx = 1 To Len(strInput)
        MatchNumber = MatchNumber & UCase(Choose(Idx, "X", "I", "N", "S", "C", "R", "U", "T", "A", "B", "Z"))
    Next Idx

    MatchNumber = Replace(MatchNumber, "Z", ".")

End Function

I'm NOT claimimg 'effiency', but simplicity and ease of understanding are at least worth review?

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
MichaelRed, your claim to simplicity and understanding - compared to shepherd's, MichaelBronner's or my methods is based on what?

Frankly, in terms of opacity, MichaelBronner's code is probably the least opaque. Sheperd's and mine both have arguable elements of efficiency, but are both a little trickier to understand in terms of how they work.

Apart from grandstanding, what are you offering here?
 
Now now Boys it’s Friday Night/Morning, Bank Holiday weekend etc etc.
Thanks for that code lad’s I will try it later, as in Saturday afternoon,
Once again Thanks for you help. The Prize is still there!!!!!!!

Duf
 
I always find it interesting to see other programmers' code.
I don't mind MichaelRed's post here at all, it just shows how very different programmers tend to think and code.
In that regard I think comparing code is great.

However, StrongM has a point: we shouldn't try to out-boast one-another. :) But I don't think thats the case here :).

Take care guys, and have a great weekend! Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top