I'd suggest to get datagridviewcell's value into variable once, then use it.
On the other hand, forget about old VB function
CDate
. Use proper .Net function:
DateTime.TryParse Method (System) | Microsoft Learn[
^]
Dim dd As DateTime
If DateTime.TryParse(dtgrdBranch.CurrentRow.Cells(4).Value.ToString(), dd) Then
txtDate.Text = dd.ToString("dd/MM/yyyy")
txtColorInDate.Text = dd.ToString("dd/MM/yyyy")
End If