Notifications
Clear all

Formato 2 casas decimal da Label...

6 Posts
4 Usuários
0 Reactions
1,528 Visualizações
(@edupm)
Posts: 0
New Member
Topic starter
 

Parece simples, mas não sei fazer.... Me ajudem

Tenho uma Label que está soma valores e está apresentando o seguinte resultado: 25455,7900000001

Pergunta...

Como formatar a Label para que exiba somente o valor de: 25455,79

E em qual evento da Label ela deve ser feita

 
Postado : 18/06/2018 10:22 am
(@xlarruda)
Posts: 0
New Member
 

tente algo do tipo:

Label1= Format(Seu_valor, "00000.00")
 
Postado : 18/06/2018 10:47 am
(@edupm)
Posts: 0
New Member
Topic starter
 

Não deu certo segue o código,

  Dim j As Long

Dim soma As Long

soma = 0

For j = 1 To Me.lstLista.ListCount - 1
soma = soma + CLng(Me.lstLista.List(j, 7))
Next j

    LabelSomaRegistros.Caption = soma
    

    If lblMensagens <> "" Then
    Dim lItem As Double
Dim Total As Double
For lItem = 0 To lstLista.ListCount - 1
If IsNumeric(lstLista.List(lItem, 7)) = True Then
        Total = Total + CDbl(lstLista.List(lItem, 7))
LabelSomaRegistros = Total & " Horas"
LabelSomaRegistros.Caption = Format(LabelSomaRegistros, "00000.00")

End If
Next
End If
 
Postado : 18/06/2018 10:54 am
(@rafaelp)
Posts: 0
New Member
 

Boa tarde edu,

Tenta assim:

 Dim j As Long

Dim soma As Long

soma = 0

For j = 1 To Me.lstLista.ListCount - 1
soma = soma + CLng(Me.lstLista.List(j, 7))
Next j

    LabelSomaRegistros.Caption = soma
    

    If lblMensagens <> "" Then
    Dim lItem As Double
Dim Total As Double
For lItem = 0 To lstLista.ListCount - 1
If IsNumeric(lstLista.List(lItem, 7)) = True Then
        Total = Total + CDbl(lstLista.List(lItem, 7))
LabelSomaRegistros = Format(Total, "#.00") & " Horas"
LabelSomaRegistros.Caption = LabelSomaRegistros

End If
Next
End If
 
Postado : 18/06/2018 11:04 am
(@edupm)
Posts: 0
New Member
Topic starter
 

Muito Obrigado Rafa :D

 
Postado : 18/06/2018 11:44 am
(@wagner-morel-vidal-nobre)
Posts: 4063
Famed Member
 

Edupm,

Boa tarde!

Por gentileza, pedimos não utilizar citações desnecessárias em suas respostas.

 
Postado : 18/06/2018 11:48 am