ciao! devo formattare un numero in una stringa in modo da ottenere sempre 2 cifre, esempio se ho 12 vedrò 12, ma se ho 6 vorrei vedere 06...
come fare???
tnx!
ciao! devo formattare un numero in una stringa in modo da ottenere sempre 2 cifre, esempio se ho 12 vedrò 12, ma se ho 6 vorrei vedere 06...
come fare???
tnx!
io farei in questo modo, non so se sia il migliore ma è l'unico che conosco e che userei anche io:
spero di esserti stato utilecodice:if len(text1)<2 then text1="0" & text1 end if
Le camice rosse ricucirono il paese,
le camice nere lo portarono alla guerra,
le camice verdi vi son pulite il culo...
Se hai nella form diversi Txt potresti usare una funzione, così:Ciao.codice:Public Function Ctr(strTesto As String) On Error Resume Next If Len(strTesto) < 2 Then Ctr = CStr("0" & strTesto) Else: Ctr = (strTesto) End If End Function ----------------------------------------- Private Sub Command1_Click() Text2.Text = Ctr(Text1.Text) End Sub
LM
ciao, un'alternativa potrebbe essere questa:
codice:strNumero = Right$("0" & Text1.Text, 2)![]()
Jupy