migrate method Rand(int) Visual Fox Pro to C#.net

Posted by ch2o on Stack Overflow See other posts from Stack Overflow or by ch2o
Published on 2012-06-05T21:21:53Z Indexed on 2012/06/05 22:40 UTC
Read the original article Hit count: 419

Filed under:
|
|
|
|

I'm migrating a Visual Fox Pro code to C #. NET

What makes the Visual Fox Pro: generates a string of 5 digits ("48963") based on a text string (captured in a textbox), if you always enter the same text string will get that string always 5 digits (no reverse), my code in C #. NET should generate the same string.

I want to migrate the following code (Visual Fox Pro 6 to C#)

gnLower = 1000
gnUpper = 100000
vcad = 1
For y=gnLower to gnUpper step 52
    genClave = **Rand(vcad)** * y
    vRound = allt(str(int(genclave)))
    IF Len(vRound) = 3
            vDec = Right(allt(str(genClave,10,2)), 2)
            finClave = vRound+vDec
            Thisform.txtPass.value = Rand(971);
    Exit
    Endif
Next y

outputs:

vcad = 1 return: 99905 vcad = 2 return: 10077 vcad = thanks return: 17200

thks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET