Issues with saving new records


Author
Message
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
When designing a form, one of our requirements is to allow the end user to enter text such as "Police Uniform" for a description.  However if the user types "Police Uniform    " (spaces), we want to trim the field.  So I turn on Trim Right in the BO.  Now I cannot type a space after the letter "e" in police. 

So I was advised to change the BindingUpdateMode to "OnValidation".  Now when I add a new record, type in a description like above, the description is NOT saved and is blank in the database and is displayed as blank on the UI form!

What gives?

Ben

Replies
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
OK, so how do I manually fire the event(s) in the BeforeSave?

So far I have:

For Each lcControl As Control In Me.Controls
     WHAT GOES HERE?
Next

I have tried RaiseEvent but it complains that I cannot call base class events directly.

Ideas?

Ben

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can raise the event from within the control by calling Me.OnValidating() or Me.OnValidated().  However, those methods are protected, so you will have to create your own textbox control and create public methods that call the protected methods.  Or you can use reflection to get the MethodInfo and invoke it on the control.  Reflection is slow and requires a good bit of code to execute a single method, but you can do it from anywhere.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ben Kim - 18 Years Ago
StrataFrame Team - 18 Years Ago
Ben Kim - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Greg McGuffey - 18 Years Ago
                         In this example you would never be able to add a space.
Trent L. Taylor - 18 Years Ago
                             I think what Greg is saying, instead of doing the Trim'ing the way...
Ben Kim - 18 Years Ago
                                 Yep, that is what I'm saying. :D

Why not just add an event...
Greg McGuffey - 18 Years Ago
                                     Trent, You are correct. I cannot type something like "Police Officer"...
Ben Kim - 18 Years Ago
                                         You're wanting an automated solution for something that will take some...
Trent L. Taylor - 18 Years Ago
Ben Kim - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Ben Kim - 18 Years Ago
Ben Kim - 18 Years Ago
StrataFrame Team - 18 Years Ago
Ben Kim - 18 Years Ago
StrataFrame Team - 18 Years Ago
Ben Kim - 18 Years Ago
StrataFrame Team - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search