Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random from VFP to VB.NET
Message
De
05/11/2003 18:32:30
 
 
À
05/11/2003 18:24:12
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00846848
Message ID:
00846863
Vues:
32
>>I would like to convert this from VFP to VB.NET:
>>
>>
>>ALLTRIM(TRANSFORM(INT(RAND()*10000000000000000000),'99999999999999999999'))
>>
>
>I did this.
>
>
>   ' Return a random file name
>   ' expC1 Start of the file name
>   Private Function GenerateFileName(ByVal tcStart As String) As String
>      Dim lnInteger As Integer
>      Dim loRandom As New Random
>      lnInteger = loRandom.NextDouble() * 1000000000
>      Return tcStart + lnInteger.ToString().PadLeft(30, "0")
>   End Function
>
>
>This is as close as I can get as I cannot get a random number for such a big number in VB.NET. If someone could enhance that code, it'd be appreciated.

If you need a 30 digit number, can't you just do what you've done 3 times as 10 digit numbers and concatenate the strings?
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform