2
When performing the conversion of a number I need to format it, and unfortunately it is not coming out the way I need it.
I need to format a number of 11 digits in CPF, but when putting the formatting, in the execution of the program, the formatting is "skipped". When putting "," it formats as money ex: "00,000,000,000,0-00" and if I put "." it doesn’t even format, and puts the - at the end of the text.
Follows the code:
If Len(numcgc) = 11 Or Len(numcgc) = 14 Then
Select Case Len(numcgc)
Case 11
If Not classe.CalculaCpf(numcgc) Then
MsgBox("ATENÇÃO! - N° do CPF inválido - Vefique")
TxtCgc.Select()
TxtCgc.Clear()
Exit Sub
End If
If IsNumeric(numcgc) Then TxtCgc.Text = Format(CLng(numcgc), "###,###,###-##")
Thank you very much, your solution worked perfectly. I didn’t understand very well how the reference of the old Vb and the current... But I still thank you deeply!
– Jaderson
@Jaderson Don’t use
CLng()
.– Maniero