我有个问题.在我的情况下,我想检索十进制值的最后一位数,以进行舍入调整.以下是我的代码:
private void calculateADJ()
{
string result = Strings.Right(txtGTotal.Text, 1);
if (result == "1" || result == "6")
{
txtStoreRA.Text = "-0.01";
txtOutstanding.Text = (Convert.ToDouble(txtGTotal.Text) - 0.01).ToString("0.00");
}
if (result == "2" || result == "7")
{
txtStoreRA.Text = "-0.02";
txtOutstanding.Text = (Convert.ToDouble(txtGTotal.Text) - 0.02).ToString("0.00");
}
if (result == "3" || result == "8")
{
txtStoreRA.Text = "0.01";
txtOutstanding.Text = (Convert.ToDouble(txtGTotal.Text) + 0.01).ToString("0.00");
}
if (result == "4" || result == "9")
{
txtStoreRA.Text = "0.02";
txtOutstanding.Text = (Convert.ToDouble(txtGTotal.Text) + …Run Code Online (Sandbox Code Playgroud)