- 最後登錄
- 2024-4-25
- 在線時間
- 294 小時
- 註冊時間
- 2009-2-23
- 閱讀權限
- 20
- 精華
- 0
- UID
- 5903028
- 帖子
- 39
- 積分
- 0 點
- 潛水值
- 9471 米
| 如果發覺自己無法使用一些功能或出現問題,請按重新整理一次,並待所有網頁內容完全載入後5秒才進行操作。 本帖最後由 terrypen 於 2014-9-11 11:31 PM 編輯
請教各位先進~我在datagridview做數值相乘運算,為什麼有小數點的數值相乘,出來會變整數,我看了MSDN還是一頭霧水,可否為小弟解惑一下,該如何進行運算才好~~謝謝!
- Dim iLong as Decimal
- Dim iWide as Decimal
- Dim iQuantity as Decimal
- iLong = CInt(DataGridView1.Rows(e.RowIndex).Cells("dgvLong").Value) '例如:iLong = 10.2
複製代碼- iWide = CInt(DataGridView1.Rows(e.RowIndex).Cells("dgvWide").Value) '例如:iWide = 5.4
- iQuantity = iLong * iWide
- DataGridView1.Rows(e.RowIndex).Cells("dgvQuantity").Value = iQuantity.ToString '值應該 = 55.08, 結果為整數
複製代碼
... |
|