> One of my sample is bound and it is working. It has to be something you did.
Is your field defined as a date field ?
Thank you for your interest. In fact, it work fine when first developed. I
then worked on other aspects of the program, and when I returned to this
form, it no longer worked. The field I am using for illustration is birthdate
(named "birth") which is a datetime in the SqlServer database running on my
laptop. There are no nulls in this column in the database. In fact, I made
the field non-nullable, and re-created the DataSet.
Let me throw in all the info.
The DateTimePicker is configured by the following lines created by the IDE.
//
// dtpBirth
//
this.dtpBirth.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dtpBirth.Location = new System.Drawing.Point(176, 112);
this.dtpBirth.Name = "dtpBirth";
this.dtpBirth.Size = new System.Drawing.Size(152, 27);
this.dtpBirth.TabIndex = 2;
For debuggin purposes, I moved the databinding to the bottom of the
constructor:
Binding b = new System.Windows.Forms.Binding("Value",
this.dsRmaAcct1, "rma_account.birth") ;
b.Format += new ConvertEventHandler(dtpFormatter) ;
b.Parse += new ConvertEventHandler(dtpParser) ;
this.dtpBirth.DataBindings.Add(b);
The eventhandlers were added for debugging purposes. If I include these
lines, the databinding fails for all controls bound to the same DataTable,
but binding works for controls bound to another table in the same DataSet.
By "fails", I mean that the data from the database is not displayed in the
controls when the record is created in the DataTable. I've checked that the
data is there, the row to display is correct, etc. Attempts to display the
data via CurrencyManager refresh have not helped. The Format event handler is
NOT called. (I changed the above lines to a different contol to test that
they are created properly.) I get the same effects using any of the datetime
fields, so "birth" is not unique.
The DataTable is created in the dataset by the following from the
IDE-created XML:
<xs:element name="rma_account">
<xs:complexType>
<xs:sequence>
<xs:element name="plan_id" type="xs:string" minOccurs="0" />
<xs:element name="rma_account" type="xs:string" />
<xs:element name="ssn" type="xs:string" />
<xs:element name="first" type="xs:string" minOccurs="0" />
<xs:element name="mi" type="xs:string" minOccurs="0" />
<xs:element name="last" type="xs:string" minOccurs="0" />
<xs:element name="addr1" type="xs:string" minOccurs="0" />
<xs:element name="addr2" type="xs:string" minOccurs="0" />
<xs:element name="city" type="xs:string" minOccurs="0" />
<xs:element name="state" type="xs:string" minOccurs="0" />
<xs:element name="zipcode" type="xs:string" minOccurs="0" />
<xs:element name="phone" type="xs:string" minOccurs="0" />
<xs:element name="country" type="xs:string" minOccurs="0" />
<xs:element name="birth" type="xs:dateTime" />
<xs:element name="sex" type="xs:string" minOccurs="0" />
<xs:element name="eff_dt" type="xs:dateTime" minOccurs="0" />
<xs:element name="can_dt" type="xs:dateTime" minOccurs="0" />
<xs:element name="init_amt" type="xs:decimal" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
I found one other post on the board from someone with the same problem, but
did not get any replies. In my case, the workaround is pretty easy, but the
program is supposed to work, damn it.