Ok,
I have a text field called H1Field, and I need it to only accept the following characters:
A B C D E F
Therefore, if a user types in any accented version of A B C D E F - I need them replaced.
Here is what I have so far:
I have created a function called ReplaceAccented in my main module, containing this code:
[code]Declare Function CFStringCreateMutableCopy Lib “CoreFoundation” (CFAllocatorRef As Ptr, _
maxLength As Integer, theString As CFStringRef) As Ptr
Declare Function CFStringTransform Lib “CoreFoundation” (CFMutableStringRef As Ptr, CFRange As Ptr, _
transform As CFStringRef, reverse As Boolean) As Boolean
Declare Function UTF8String Lib “Foundation” Selector “UTF8String” (NSString As Ptr) As CString
Dim mutableStringRef As Ptr = CFStringCreateMutableCopy(Nil, 0, s)
If Not CFStringTransform(mutableStringRef, Nil, "Any-Latin; Latin-ASCII", False) Then
Raise New RuntimeException()
End
Return UTF8String(mutableStringRef)[/code]
I then have this code (which needs to go in a text field’s change event), in order to replace any accented characters as they are typed:
Dim TextToReplace As String = "ÀÁÂÃÄÅÆÇÈÉÊËÐàáâãäåæçèéêë?????????????????????"
TextToReplace.ReplaceAccented()
Would this code replace (for example) à with a, as soon as they type it?
I cannot test this as I am currently away from my main machine.
Thank you for all the help.