Time data entry

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I have a drop down filled with time values (13:00, 14:00... etc.) and bound
to a datetime field. The problem is that when user selects a time value say
"14:00" in the drop down list, it becomes "10/07/2004 14:00:00" in the drop
down edit area. Is there a way to restrict the datetime field to accept time
values only?

Thanks

Regards
 
Hi John,

Are you talking about a
DropDown control,
or a
DropDownList control
or a
Combobox

I quest the last because you are talking about binding.

Cor
 
Typo
I quest the last because you are talking about binding.
I ask the last question because you are talking about binding.

And thinking about that is this sample beneath probably your answer.
(This is a textbox and this is just the opposite part you are asking)

I hope this helps?

Cor

\\\
Private Sub myroutine()
Mybinding = New Binding("Text", ds.Tables(0), "mydatfield")
textdatfield.DataBindings.Add(Mybinding)
AddHandler mybinding.Format, AddressOf DBdateTextbox
AddHandler mybinding.Parse, AddressOf TextBoxDBdate
End sub
Private Sub DBdateTextbox(ByVal sender As Object, _
ByVal cevent As ConvertEventArgs)
If cevent.Value Is DBNull.Value Then
cevent.Value = ""
Else
Dim datum As Date
datum = CDate(cevent.Value)
cevent.Value = datum.ToString("dd - MM - yyyy")
End If
End Sub
Private Sub TextBoxDBdate(ByVal sender As Object, _
ByVal cevent As ConvertEventArgs)
If cevent.Value.ToString = "" Then
cevent.Value = DBNull.Value
End If
End Sub
///
 
Back
Top