473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

'Date' databinding

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
Nov 21 '05 #1
1 1122
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" <ag***@dynamictech.com.hk> wrote in message
news:eo**************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Reza | last post by:
Hi I have a column in my datagrid that can have values of null at times. I am not assigning any value to it, if it is coming from Database empty. Now, the problem is I guess the datetime variables...
1
by: VC | last post by:
I have a textbox where users type in a date. I want to check that the input is between year 2000 and the current date. Here is segment of the codes that give me the "Server tags cannot contain...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
9
by: Shapper | last post by:
Hello, I created a dataset from a XML file. One of the dataset fields is . In an ASP:Repeater I am displaying the field. <%# DataBinder.Eval(Container.DataItem, "pubDate", "{0:f}") %> The...
4
by: zdrakec | last post by:
Hello all: I'm having no problem with formatting a date, when I have one, but when the Container.DataItem is DBNull, then my date formatting blows up (Cast from DBNull to Date not valid). I've...
1
by: Nathan Sokalski | last post by:
I have a field in a dataset (which I filled using an Oracle database) that contains a date. I want to format the date to look like the ToLongDateString() method. The current code that I have in my...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
12
by: tarscher | last post by:
Hi all, A simple problem that seems hard to solve... I have a gridview with a date row. <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("time") %>'></asp:Label>...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello to all, I want to know if DataBinding in asp.net 2,0 is better than to fill up the values of the controls of the following form: this.miControlTextBox.Text = valorParaControlTextbox; ...
0
by: AboutJAV | last post by:
Hi, I am using a DateTimePicker control to allow the user to select a new date. At first, I use an event Date_Changed Event as well as databinding the control to a property. When the user click...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.