79566750

Date: 2025-04-10 13:21:01
Score: 1
Natty:
Report link
Hola, el problema es que estás intentando formatear algo como si fuera una cadena de texto con formato de fecha u hora.

Pero como el valor es un TimeSpan, no acepta el formato "hh:mm:ss" directamente en la propiedad .DefaultCellStyle.Format.

Tenes que convertir el TimeSpan manualmente.
Justo después de llenar el DataGridView, podés recorrer las filas y formatear el valor, ejemplo:

For Each row As DataGridViewRow In DataGridView1.Rows
    If Not row.IsNewRow Then
        Dim hora As TimeSpan = CType(row.Cells(2).Value, TimeSpan)
        row.Cells(2).Value = hora.ToString("hh\:mm\:ss") ' O solo "hh\:mm"
    End If
Next
Reasons:
  • Blacklisted phrase (1): está
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: jazlq1