|
-
Apr 29th, 2000, 02:41 AM
#1
Thread Starter
Addicted Member
How to put any character in a textbox EXCEPT the backslash ?
-
Apr 29th, 2000, 03:28 AM
#2
transcendental analytic
Do you need to remove all the "\" or do you want these to be left in a variable?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 29th, 2000, 04:15 AM
#3
Addicted Member
Try this to disallow a "\" from being entered into the TextBox:
Code:
Private Sub Text1_Change()
Dim lPrevPos As Long
If InStr(1, Text1.Text, "\") Then
lPrevPos = Text1.SelStart - 1
Text1.Text = Replace(Text1.Text, "\", vbNullString)
If lPrevPos > Len(Text1.Text) Then
Text1.SelStart = Len(Text1.Text)
Else
Text1.SelStart = lPrevPos
End If
End If
End Sub
[Edited by SonGouki on 04-29-2000 at 05:16 PM]
Dan PM
Analyst Programmer
VB6 SP3 (also VB4 16-bit sometimes  )
-
Apr 29th, 2000, 07:15 AM
#4
Member
Or can do something like this
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 92 Then
KeyAscii = 0
End If
End Sub
-
Apr 29th, 2000, 09:49 AM
#5
Addicted Member
mlana,
That will work fine for regular typing into the TextBox, but is useless when the user pastes. My code disallows the undesired string completely, try it out
Dan PM
Analyst Programmer
VB6 SP3 (also VB4 16-bit sometimes  )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|