F
Fred Morrison
I need to bind a true date value to a listbox control via a DataSet that
contains true date values (not strings). The problem is, the list contains
the time (always midnight in my case). Other than trying to shrink the
width of the control to hide the time (won't work if it's a combobox I
notice), how can I force the listbox "format" of the display member to be a
particular style (mm/dd/yyyy in my case)?
Example:
' Bind the returned dataset of date values to the listbox (or combo box)
Dim strDisplayMember As String = ds.Tables(0).Columns(0).ColumnName
With Me.lbxExample
.DataSource = ds.Tables(0).DefaultView
.DisplayMember = strDisplayMember
.ValueMember = strDisplayMember
.SelectedIndex = -1
End With
contains true date values (not strings). The problem is, the list contains
the time (always midnight in my case). Other than trying to shrink the
width of the control to hide the time (won't work if it's a combobox I
notice), how can I force the listbox "format" of the display member to be a
particular style (mm/dd/yyyy in my case)?
Example:
' Bind the returned dataset of date values to the listbox (or combo box)
Dim strDisplayMember As String = ds.Tables(0).Columns(0).ColumnName
With Me.lbxExample
.DataSource = ds.Tables(0).DefaultView
.DisplayMember = strDisplayMember
.ValueMember = strDisplayMember
.SelectedIndex = -1
End With