I have the following 2 queries:
1) I have a maintenance form with 2 bound textboxes, 1 textbox for a db field name (textBox1) and the other for a friendly display name (textBox2). During New i would like the friendly name to be the mirror of the field name whilst the user is inputting the data. I have set. In the Change event on textBox1 I set
textBox2.Text = textBox.Text
When I run the app and attempt to create a new record, I enter a character into textBox1 the change event is invoked and the data is copied to textBox2 but then the character is obliterated. Any subsequent keypress results in a blank textBox1 and textBox2. I have noticed that there seems to be multiple calls to the change event when a single key is pressed. Does anyone have an explanation for this?
2) When I update a new record I get the error "Cannot insert the value NULL into config_pk etc. I have the properties on the PrimaryKeyIsAtoIncremented= True and PrimaryKeyIsUpdateable= false. Is there another property that I should look out for?
many thanks
For you # 1 question try handling the property changing event on the business object. To enable the event look under advanced options in the business object mapper. you should be able to handle it and do something like to code below to accomplish what you want
'set shrtname field to the first 7 characters of the customer name while adding
For # 2 are you only getting the error when you update a record?
Are you using an integer PK and having SQL handle the increment or are you passing in your own PK?
Sorry about the delay in responding. I am trying to insert a new record. I have declared the pk to be an integer. In the Business object I have :
PrimaryKeyIsAutoIncremented= true and PrimaryKeyIsUpdatable=false.
Many thanks