General information
Category:
The Mere Mortals .NET Framework
Title:
Calling button code not working
I put a mmButtonSave on my form to save a receiver record. The users will click this button when they modify the record.
Because I am using another button and code to create and save the receiver record only if a line item record was created, I am trying to call the code behind the button to save the new receiver record.
'This doesn't work
'Save the receiver row
Me.btnRecvSave.PerformClick()
'Check for row saved
If Me.btnRecvSave.Result <> mmSaveDataResult.RulesBroken Then
Me.lblMessLineItems2.Text = "Receiver record saved."
The result comes back true, but it didn't actually save the record. No key field was created, and if I try to move off the record the program asks me if I want to save the record. If I say Yes, the row is then actually created and saved in the SQL table.
However, if I use the following code, the row _is_ saved correctly:
'Save the receiver row
Me.oReceivers.SaveDataSet()
'Check for row saved
Dim llSavedOK As Boolean = CBool(mmSaveDataResult.RulesPassed)
If llSavedOK Then
Me.lblMessLineItems2.Text = "Receiver record saved."
This code seems to work fine. So why is the other code not working?
Maybe I'm not calling the code behind the button correctly? Any ideas?
Thanks.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only