PC Review


Reply
Thread Tools Rate Thread

'Date' databinding

 
 
Agnes
Guest
Posts: n/a
 
      8th Aug 2004
The following gived by Cor work great.
However, as I put them in "form_load", the textbox ALWAYS show the time
also.
After I move the position of the table, it will show "according to my
setting " (yyyy/MM/dd) "
I try to put Me.refresh , in form_load, but it seems useless. Thanks in
advance

private sub load
Me.txtTransDate.DataBindings.Add("Text", dsSeaInvInfo,
"InvoiceHeader.transdate")
AddHandler txtTransDate.DataBindings("Text").Format, AddressOf
DBdateTextbox
AddHandler txtTransDate.DataBindings("Text").Parse, AddressOf
TextBoxDBdate
end load
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("yyyy/MM/dd")
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


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      8th Aug 2004
Hi,

I over came that problem by placing a label over the textbox and
then hiding it. It forces the textbox to get the value from the data source
and the format event is fired that time.

Ken
--------------------------
"Agnes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
The following gived by Cor work great.
However, as I put them in "form_load", the textbox ALWAYS show the time
also.
After I move the position of the table, it will show "according to my
setting " (yyyy/MM/dd) "
I try to put Me.refresh , in form_load, but it seems useless. Thanks in
advance

private sub load
Me.txtTransDate.DataBindings.Add("Text", dsSeaInvInfo,
"InvoiceHeader.transdate")
AddHandler txtTransDate.DataBindings("Text").Format, AddressOf
DBdateTextbox
AddHandler txtTransDate.DataBindings("Text").Parse, AddressOf
TextBoxDBdate
end load
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("yyyy/MM/dd")
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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gridview, databinding, date and formatting problem tarscher@gmail.com Microsoft ASP .NET 12 27th Dec 2006 01:55 PM
Formatting a date obtained using databinding Nathan Sokalski Microsoft ASP .NET 1 17th Aug 2005 11:09 AM
Re: Databinding null date values-How to? Tim Wilson Microsoft Dot NET Compact Framework 1 2nd Jun 2004 06:31 PM
using databinding and datetime, only need the date, not time (dob) dwight0 Microsoft Dot NET Framework Forms 0 24th Dec 2003 08:54 PM
Date/Time Databinding Katty Microsoft ADO .NET 3 30th Nov 2003 06:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:16 AM.