Hi,
I ve connected or better created with the datasource a DataGrid where I have in one column seconds. This seconds I want to display in the format hh:mm:ss.
Fot his I can use this code
but eerytime when I try to write it back I get the error that I just can write int32 and I also tried to change it with the DefaultSytle but without luckCode:Dim t As New TimeSpan(0, 0, row.Cells(DataGridViewTextBoxColumn6.Index).Value)
Can please someone give me a hint how to solve it?Code:Private Sub ConvertTime() DataGridViewTextBoxColumn6.DefaultCellStyle.ToString() For Each row As DataGridViewRow In ProduccionDataGridView.Rows If row.Cells(DataGridViewTextBoxColumn6.Index).Value Is DBNull.Value = False Then Dim t As New TimeSpan(0, 0, row.Cells(DataGridViewTextBoxColumn6.Index).Value) 'row.Cells(DataGridViewTextBoxColumn6.Index).Style.Format = "HH:mm:ss" 'row.Cells(DataGridViewTextBoxColumn6.Index).ToString() row.Cells(DataGridViewTextBoxColumn6.Index).Value = (t.Hours & ":" & t.Minutes & ":" & t.Seconds).ToString 'row.Cells(DataGridViewTextBoxColumn6.Index).Value = DateAndTime 'row.Cells(DataGridViewTextBoxColumn6.Index).Value = t.Hours & t.Minutes & t.Seconds End If Next End Sub
Thanks
Stephan


Reply With Quote