how would i make it so when somebody put an e in an rtf box, it would change to an é?
Printable View
how would i make it so when somebody put an e in an rtf box, it would change to an é?
VB Code:
Private Sub RichTextBox1_KeyPress(KeyAscii As Integer) If KeyAscii = 101 Then KeyAscii = 233 End If End Sub
thanks that helps a lot, but if they put a k, how would i make it show |<
Find the ascii value of K and replace it with the 2 chars you need. Do a search on the web for ASCII and you will find a few character charts.
Can probably even find them in Character Map on your PC.
lol, thats what i did, but i don't know how to put 2 chars
Try this
VB Code:
If keyascii = InsertAsciiCodeHere Then RichTextBox1.SelText = "|<" keyascii = 0 End If
To get an ASCII code simply type the following in the debug/immediate window:Quote:
Find the ascii value of K and replace it with the 2 chars you need. Do a search on the web for ASCII and you will find a few character charts.
Can probably even find them in Character Map on your PC.
... and then press enter. The ASCII code should appear then.Code:print asc("character")
Also Visual Basic should have a chart some where in the help files.
As for your other questions:
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim CursorPos As Integer
CursorPos = Text1.SelStart
If KeyAscii = Asc("e") Then Text1.Text = Text1.Text + Chr$(233): KeyAscii = Empty
If KeyAscii = Asc("k") Then Text1.Text = Text1.Text + "|<": KeyAscii = Empty
Text1.SelStart = CursorPos + 1
End Sub
The code probably is not the best sollution but I hope it will help you any way.
k, thanks i got my app working nicely, but now there is another problem. i want to put a ì into it for g, but it shows up as a ? any way to fix that?
EDIT
the g, with an accent turns into an ì here. but, it looks like a g normally, but it has an accent