Re: Binding DateTimePicker
- From: "Bart Mermuys" <bmermuys.nospam@xxxxxxxxxxx>
- Date: Sun, 31 Dec 2006 08:05:26 GMT
Hi,
"John Stivenson" <JohnStivenson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9D50C122-47ED-4466-A8A0-4C311FCDBD43@xxxxxxxxxxxxxxxx
"Bart Mermuys" wrote:
In this case I want to store the current date instead of NULL.
How can I achive this?
Try to set default values on the DataSource.
If you're using NET2.0 you can use the DataTable.TableNewRow event.
It seems as a good solution, but I don't know how to do this.
Where should I add TableNewRow event handler?
It depends on a couple of things...
First, you don't mention that you are using NET2.0, the event is only
available in NET2.0, since you consider the option i assume you are.
Second, it would also be different depending on how and where you create the
DataSet/DataTable which you have bound.
And last, the language you are using.
// Assuming you are using NET2.0, you've added the
// (typed) DataSet/DataTable using the designer and are
// using C#, then you would do something like:
public partial class SomeForm : Form
{
public SomeForm()
{
InitializeComponent();
// add handler after InitializeComponent
someDataSet.someDataTable.TableNewRow +=
new DataTableNewRowEventHandler( OnSomeTable_TableNewRow );
}
private void OnSomeTable_TableNewRow( object sender,
DataTableNewRowEventArgs e )
{
// set default values
e.Row["someField1"] = ....;
e.Row["someField2"] = ...;
...
}
}
HTH,
Greetings
Thanks in advance.
.
- References:
- Re: Binding DateTimePicker
- From: Bart Mermuys
- Re: Binding DateTimePicker
- Prev by Date: Re: I need an advice...
- Next by Date: Re: I need an advice...
- Previous by thread: Re: Binding DateTimePicker
- Next by thread: Re: MI5 Persecution: my response to the harassment
- Index(es):