|
-
Feb 11th, 2004, 11:31 AM
#1
Thread Starter
Lively Member
Data binding update problem
I am having a problem getting a single field to update a dataset. In my "SaveInvoice" sub, I have several labels with a tag property that is bound to a field in the dataset. Before updating the underlying tables, I am assigning the proper values to the .tag properties of the various labels, and then doing an "EndCurrentEdit." However, when I update the database, I find that one of the properties did not update properly. If I step through the code line by line and check out the values, I see that all the tag properties have the proper value until executing the line with the EndCurrentEdit, at which point, the lblInvoiceStatus.tag reverts back to what it was before, for no apparent reason. None of the other tags seem to be doing this. I am using the ComponentOne data navigator thingie (C1InvoiceNavigator) and am calling the EndCurrentEdit method through it. Here is the code:
Code:
Private Sub SaveInvoice()
Try
'Save the current invoice to dataset and update the database
Me.lblCustName.Tag = mintCurrentCustomer
Me.lblInvVehicle.Tag = mintCurrentVehicle
Me.lblInvoiceStatus.Tag = mintCurrentStatus
'Convert tax and total values to decimal values and store in the .tag properties
Me.lblSalesTax.Tag = IIf(Me.lblSalesTax.Text <> "", CType(Me.lblSalesTax.Text, Decimal), 0D)
Me.lblTotal.Tag = IIf(Me.lblTotal.Text <> "", CType(Me.lblTotal.Text, Decimal), 0D)
Me.lblBalanceDue.Tag = IIf(Me.lblBalanceDue.Text <> "", CType(Me.lblBalanceDue.Text, Decimal), 0D)
'End the current edit
Me.C1InvoiceNavigator.BindingContext(Me.dsInvoices1, "tblInvoices").EndCurrentEdit()
'Update the underlying tables
Me.daInvoices.Update(Me.dsInvoices1.tblInvoices)
Me.daInvoiceDetails.Update(Me.dsInvoices1.tblInvoiceDetails)
mblnNewInvoiceMode = False
mblnInvoiceIsDirty = False
Catch ex As Exception
MsgBox(ex.StackTrace & vbCrLf & vbCrLf & "Error: " & ex.Message, MsgBoxStyle.Critical, "Error")
End Try
End Sub
Any ideas why the EndCurrentEdit is causing lblInvoiceStatus.tag to revert back to its previous value?
Thanks,
Ken
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|