Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Did someone ask about editing per chacter entry

Status
Not open for further replies.
Jul 7, 1999
101
0
0
US
I have some code that edits EACH keystroke for specific types.. tusconpapa
 
Tusconpapa,<br>
<br>
Just post it here Tusconpapa, lots of people &quot;lurk&quot; (read everything but don't post&quot; who will find it useful.<br>
<br>
Mike<br>
--- <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href=http:// Cargill's Corporate Web Site</a><br>
 
Mike ,I found this in some veryold code <br>
Private Sub Amount_Change()<br>
Dim strvalid As String<br>
strvalid = &quot;0123456789.&quot;<br>
If keyascii &gt; 26 Then<br>
If InStr(strvalid, Chr(keyascii)) = 0 Then<br>
keyascii = 0<br>
End If<br>
End If<br>
AccessKeys = vbKeyReturn<br>
End Sub<br>

 
I would like to show u some code for Maskedit, but<br>
my copy is a very early BATA release with a random<br>
number error generator so u always get a different<br>
error number even if u follow the same steps. DON'T<br>
U just love the maskedit. ! of course it's undocumemted, why change now ! T.
 
I use this one a lot, I use the tag property for the filtering.<br>
The Val(&quot;12,2&quot;) is to find out what the decimal point is comma or a period intead of using an API to find the locale.<br>
<br>
Function filtext(KeyAscii As Integer, tag As String) As Integer<br>
Dim txt As String<br>
Dim nut As String<br>
Dim datf As String<br>
Dim telf As String<br>
datf = &quot;1234567890/-&quot;<br>
If Val(&quot;12,2&quot;) = 12 Then<br>
nut = &quot;1234567890,-&quot;<br>
Else<br>
nut = &quot;1234567890.-&quot;<br>
End If<br>
telf = &quot;1234567890/-() &quot;<br>
txt = &quot;abcdefghijklmnopqrstuvwxyz ABCDEFGHI'JKLMNOPQRSTUVWXYZÑñáéíóú&quot;<br>
filtext = KeyAscii<br>
If tag = &quot;a&quot; Then<br>
If InStr(1, txt, Chr(KeyAscii)) &gt; 0 Then filtext = KeyAscii Else filtext = 0<br>
ElseIf tag = &quot;n&quot; Then<br>
If InStr(1, nut, Chr(KeyAscii)) &gt; 0 Then filtext = KeyAscii Else filtext = 0<br>
ElseIf tag = &quot;t&quot; Then<br>
If InStr(1, telf, Chr(KeyAscii)) &gt; 0 Then filtext = KeyAscii Else filtext = 0<br>
ElseIf tag = &quot;d&quot; Then<br>
If InStr(1, datf, Chr(KeyAscii)) &gt; 0 Then filtext = KeyAscii Else filtext = 0<br>
ElseIf Left(tag, 1) = &quot;s&quot; Then<br>
If InStr(1, tag, Chr(KeyAscii)) &gt; 0 Then filtext = KeyAscii Else filtext = 0<br>
End If<br>
If KeyAscii = 8 Or KeyAscii = 9 Then filtext = KeyAscii<br>
End Function<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top