How to force ToUpper a value entered by end user?


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi All,

I have a field name State, and I want that the value entered by the end user is force to Upper case.  What would be the best approach for this?

I know I can trap the control's TextChanged event and change the value there, but I am looking for a cleaner solution at the BO level so I don't have to do the modification in all form's this field may be used. 

I wish the Business Object Mapper could handle this kind things pretty much the way they handle the Trim.  It looks obvious to me this could be done in the BOM as an enhancement.

Edhy Rijo

Replies
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
You would need to add code to handle the text changed event in your base class to force the textbox to stay at the end. You could also probably simply handle the before save event and set the field's value there. I was working from home last nite and did not think.  

Private Sub BusinessObject1_BeforeSave(ByVal e As MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs) Handles Me.BeforeSave

Me.fieldname = Me.fieldname.ToUpper

End Sub

 

 

Public Class AL_TextBox

Inherits MicroFour.StrataFrame.UI.Windows.Forms.Textbox

#Region "Constructor"

Public Sub New()

InitializeComponent()

End Sub

#End Region

#Region " Init Component"

''' <summary>

''' Set any default property's

''' </summary>

''' <remarks></remarks>

Private Sub InitializeComponent()

'-- You can set here as a default for all your text boxes

Me.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper

End Sub

#End Region

''' <summary>

''' This forces the cursor to always go to the end of the text

''' </summary>

''' <param name="sender"></param>

''' <param name="e"></param>

''' <remarks></remarks>

Private Sub AL_TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged

' Declare variables

Dim LoTextBox As MicroFour.StrataFrame.UI.Windows.Forms.Textbox = sender

LoTextBox.Select(LoTextBox.Text.Length, 0)

End Sub

End Class


Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Paul,

Once again, thanks a lot for the sample code and the instructions, it does help specially when you know how to do all this in other programming tool like VFP (for over 20 years) and now learning the new stuff can be frustrating sometimes.

I will take the class approach since I want the user to see the typed character in upper case.  But I am saving all other suggestions in my file bag for future use.  Hehe

Edhy Rijo

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I know the feeling I am converting a FPW 2.6 \ VFP app to .Net. what really-really sucks is when I have to go in and make changes to the 2.6 code.. no intellisence etc.. It's like being forced to watch black and white television.BigGrin.

Once you get used to .Net it is great it just takes a little time getting over that curve, also the Fox Frameworks had many-many years to add all these nifty types of features.

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
I know the feeling I am converting a FPW 2.6 \ VFP app to .Net.

Good to know I'm not alone in this boat... Satisfied

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search