Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling button code not working
Message
From
21/02/2007 08:36:13
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Calling button code not working
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01197575
Message ID:
01197575
Views:
63
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
Map
View

Click here to load this message in the networking platform