Jump to content

Recommended Posts

Posted

Como faço para meter uma variável Integer com um mínimo de 2 casas, ou seja, caso queira lá guardar o número 3 ficar guardado 03 ?

Ou então uma maneira fácil de converter ?

Obrigado desde já 😄

PS: É muito urgente!

Posted

Um Integer não grava sob a forma "03" - isto é uma String. Um Integer simplesmente grava o valor - o output é que pode ser formatado.

Deve haver funções para isso, mas já não uso VB.NET há algum tempo, pelo que há sempre isto:

If ((numero < 10) AndAlso (numero >= 0)) Then
    texto = "0" & numero.ToString
End If

O StringFormat deverá fazer algo deste género, mas fica uma proposta mais "caseira". 😄

PS: É muito urgente!

Não há questões mais ou menos urgentes no P@P.

Knowledge is free!

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...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.