I want to create a generic sub that will loop through the BO field collection, picking up only the database fields of course, determine the field type and if it is of type String, trimend.Right now I have code like this in the CheckRulesOnCurrentRow event:
' Trim off trailing spaces
Me.ClassType = Me.ClassType.TrimEnd()
Me.LocalState = Me.LocalState.TrimEnd()
Me.OffenseClass = Me.OffenseClass.TrimEnd()
Me.DescriptionText = Me.DescriptionText.TrimEnd()and so forth for every string based field. I would like to do something like (pseudo code):
Public Sub TrimAll(ByRef MyBO As BusinessObject)
For Each DBField In MyBO ' How to determine the property is a DBField???
If DBField.Type = StringType ' Is it stored in the BO as a String or as the DBType?
DBField.FieldValue = Me.DBField.TrimEnd()
End If
End For
End Sub
Again this way I can create a generic sub, pass the BO to the function from the CheckRulesOncurrentRow event and have the fields trimmed for me instead of listing dozens sometimes hundreds (depends on table) of fields to do the same.
Sorry for all of the newbie type questions!
Ideas?
Ben