喜誰能幫我這個即時消息與此錯誤現在坐了有一個小時,但無法弄清楚如何解決這個錯誤我的代碼是轉換無效
'Calculate the total of hours worked
'Declare a Date Time Variable
Dim TempDateTime As DateTime = Nothing
'Declare a local time span variable
Dim TempTimeSpan As New TimeSpan
'Declare a array of type string and set the size equal to number of text boxes.
Dim arr(6) As String
'set the value for text boxs to array
arr(0) = lblmontotal.Text
arr(1) = lbltuestotal.Text
arr(2) = lblwedtotal.Text
arr(3) = lblthurstotal.Text
arr(4) = lblfridtotal.Text
For i As Integer = 0 To arr.Length - 1
TempDateTime = CDate(arr(i))
TempTimeSpan = TempTimeSpan.Add(New TimeSpan(TempDateTime.Hour, TempDateTime.Minute, 0))
Next
'showing the total time.
lbltotalhours.Text = (TempTimeSpan.Hours & ":" & TempTimeSpan.Minutes)
使用'新的datetime(ARR(I))' – user1937198
感謝快速reply..let我嘗試的..哎 – daniloJR
對不起,作爲一個菜鳥但我有另一個問題..在嘗試代碼後,它返回此錯誤「從字符串」00:00:00「轉換爲類型」長「無效。」 – daniloJR