0
我有一個datagridview和3個文本框和datagrid視圖填寫了這些列,法院費用和索賠amt 我不需要在datagridview,total courtfee和總索賠金額的行我有對總法院和沒有請求進行了排序,但堅持了總索賠金額。在datagrid視圖中添加總列值
no of rows in datagridviews, = 4 which should be in this format (00004)
total court fee = total court fee value = 60 (15 each requests) (000006000)
total claim amount = 4000 (which should be in this format 0000004000) but i get this value (0000001000).
這是我的代碼:
所有的decimal requests = 0;
decimal CFee = 0;
decimal CLAIMAMT = 0;
int j = 0;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
string strrequests = dataGridView1.RowCount.ToString();
while (strrequests.Length < 5)
strrequests = "0" + strrequests;
textBox2.Text = strrequests.ToString();
//string strCFee = (dataGridView1.Rows[j].Cells["CFee"].Value).ToString();
string strCFee = ((Convert.ToDecimal(dataGridView1.Rows[i].Cells["CFee"].Value)/100) * dataGridView1.RowCount).ToString();
for (j = 0; j < 5; j++)
strCFee = "0" + strCFee;
while (strCFee.Length < 9)
strCFee += "0";
textBox3.Text = strCFee;
// string strCLAIMAMT = (dataGridView1.Rows[j].Cells["CLAIMAMT"].Value).ToString();
string strCLAIMAMT = ((Convert.ToDecimal(dataGridView1.Rows[i].Cells["CLAIMAMT"].Value)/100)).ToString();
for (j = 0; j < 5; j++)
strCLAIMAMT = "0" + strCLAIMAMT;
while (strCLAIMAMT.Length < 10)
strCLAIMAMT += "0";
textBox4.Text = strCLAIMAMT;
} }
由於喬爾......這是超級..執行完美.. 。 – smrithi