Hello,
I thought that my DateTimePicker was bound to my binding source in my entry
form, but it does not behave as though it were.
Here is the AutoGenerated code for that control:
// modifiedDateDateTimePicker
//
this.modifiedDateDateTimePicker.DataBindings.Add(new
System.Windows.Forms.Binding("Value", this.bsMTask, "ModifiedDate", true));
this.modifiedDateDateTimePicker.Enabled = false;
this.modifiedDateDateTimePicker.Location = new
System.Drawing.Point(129, 366);
this.modifiedDateDateTimePicker.Name =
"modifiedDateDateTimePicker";
this.modifiedDateDateTimePicker.Size = new
System.Drawing.Size(200, 20);
this.modifiedDateDateTimePicker.TabIndex = 25;
Here is exception text that is returned when I get the error: "Column
'ModfiedDate' does not allow nulls."
************** Exception Text **************
System.Data.NoNullAllowedException: Column 'ModifiedDate' does not allow
nulls.
at System.Data.DataColumn.CheckNullable(DataRow row)
at System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs args,
DataRow eRow, DataRowAction eAction, Boolean fireEvent)
at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32
proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position,
Boolean fireEvent, Exception& deferredException)
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32
pos, Boolean fireEvent)
at System.Data.DataView.FinishAddNew(Int32 currentIndex, Boolean success)
at System.Data.DataRowView.EndEdit()
at System.Windows.Forms.CurrencyManager.EndCurrentEdit()
at System.Windows.Forms.BindingSource.EndEdit()
at HIP2007.AddEditMasterTask.btnSave_Click(Object sender, EventArgs e) in
M:\HIP2007\HIP2007\Dialogs _ CurrentWork\AddEditMasterTask.cs:line 92
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
I thought that the default value of the DateTimePicker was the value that is
displayed in the control - the current datetime.
BTW I have disabled this control from user interaction so that it will
behave as read only.
What do I do so that today's datetime is by default put into the control so
I do not receive this error?
Thank you.
Doug