ToString("C")在VB中没有显示预期的结果。

问题描述 投票:0回答:1

每当我尝试这个编码时,输入值就会变成$0.00。

Private Sub btnEnt_Click(sender As Object, e As EventArgs) Handles btnEnt.Click

    Dim result As String

    Dim earn As Decimal

    txtEarning.Text = earn.ToString("C")

    result = txtFName.Text & " " & txtLName.Text & " Worked" & vbCrLf

    result &= nudHr.Value & " Hrs today"

    result &= " and his earning is " & txtEarning.Text

    txtRes.Text = result

End Sub

enter image description here

不显示输入值,而是自动转换为$0. 00。

vb.net tostring render-to-string
1个回答
0
投票

我想你可能需要这个。

Dim earn as Decimal = nudHr.Value * 20

如果你的人每小时赚20美元

© www.soinside.com 2019 - 2024. All rights reserved.