Combobox Showing wrong date Format

  • Thread starter Thread starter Gary Simpson
  • Start date Start date
G

Gary Simpson

Guest
Hi Good People

I have a ComboBox on my form called ( cmbSearchDate )

Now where the Form Loads the ComboBox gets populated with data (Dates) from my Database. But On Dropdown the dates appear as 02/05/2020 00:00:00. When I require only ( 02/May/2020 ) format (dd MMMM yyyy)

I have tried changing the properties of the ComboBox I have also tried different combinations of code like...

Function GetDateFromString(s As String) As Date
Dim d As Date
If Date.TryParse(s, d) Then Return d
Return Date
End Function

And


Private Sub cmbSearchDate_DropDown(sender As Object, e As EventArgs) Handles cmbSearchDate.DropDown

cmbSearchDate.Text = CDate(cmbSearchDate.Text).ToString("dd MMMM yyyy")

End Sub




But to no avail.

Can anyone help me on this issue I have.

Kind Regards

Gary




Gary Simpson

Continue reading...
 
Back
Top