我试图将总时数列为总时数,如下所示:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If DataGridView1.RowCount > 1 Then
Dim IntTotalHours As Decimal = 0
Dim IntPricePerhour As Integer = 0
For Index As Integer = 0 To DataGridView1.RowCount - 1
IntTotalHours += Convert.ToDecimal(DataGridView1.Rows(Index).Cells(2).Value)
Next
TextBox1.Text = IntTotalHours
TextBox3.Text = FormatCurrency(IntTotalHours * 15)
End If
End Sub
但我收到错误:
IntTotalHours += Convert.ToDecimal(DataGridView1.Rows(Index).Cells(2).Value)
如何使用datagridview将时间转换为十进制?