Link to home
Start Free TrialLog in
Avatar of darkmoon_soft
darkmoon_soft

asked on

Converting text into symbol characters.

Hi, I would like to know how to do the following.

I have 2 textboxes, Text1, and Text2.

When you type into Text1, I would like to see the characters, as you type appear in Text2, and appear as symbol characters.

Say you typed    a  into text1  then you'll get   â  in text2.

As you keep on typing, you can make words, and allow for spaces.

Thanks
David
Avatar of supunr
supunr

set the font of the text2 as "symbol" at design time.
then

Private sub Text1_Change()
     text2.Text = text1.text
End Sub

Good Luck!
to set the font at run time...

Private sub Form_Load()
    Text2.Font = "Symbol"
End Sub

Avatar of darkmoon_soft

ASKER

oh, very soory, as i posted this i had characters that had to be done while holding "alt". And they did not display. That is kinda what i would like, but i want the characters like, if you type a, then you get that funny looking a, you know the one with the line though it, or the that funny looking circle on top, ect. I want this to happen to all the characters, say you type s, then it will be a $.

Thanks
oh, very soory, as i posted this i had characters that had to be done while holding "alt". And they did not display. That is kinda what i would like, but i want the characters like, if you type a, then you get that funny looking a, you know the one with the line though it, or the that funny looking circle on top, ect. I want this to happen to all the characters, say you type s, then it will be a $.

Thanks
you are going to need to hard code in the characters you want. like make 2 arrays and position 18 in the 1st array would be s and 18 in the 2nd array would be $

to detect alt:

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

if keycode = 18 then
  'alt has been detected
  'set a flag to show alt is pressed
  if flag is true then
    text2.text = text2.text + right$(text1.text,1)
  end if
end if

End Sub
Ok, very sorry, my first post did not submit right. I will explain much better here.

I have 2 text boxes, Text1 and Text2. When I type into Text1, and want what ever was typed into text1 to appear in text2, but be converted into ascii symbols.

Say I type "a" into text1, in text2 i want it to appear as a different character, of my choice, which i want it to be, the "a" with the funny circle on top of it.

@hazgod , you code does not work. I get a Type MisMatch error.
try using the foll code but lot of hardcoding needs to be done to suit ur reqmt. Like mentioned by Hazgod.

U can call a small function which does this work for u.

Private Sub Text1_Change()
If Right(Text1, 1) = "a" Then
    Text2.Text = Text2.Text & Chr(229)  'a with funnycircle
End If
End Sub
great, so far, how would I make heaps of them, one for each character?

thanks
try using the foll code but lot of hardcoding needs to be done to suit ur reqmt. Like mentioned by Hazgod.

U can call a small function which does this work for u.

Private Sub Text1_Change()
If Right(Text1, 1) = "a" Then
    Text2.Text = Text2.Text & Chr(229)  'a with funnycircle
End If
End Sub
how would I make heaps of them, one for each character?
where should i put them all, i want to have a-z and A-Z of them. do they all go in that if statement, is there anyting else that i add?
ASKER CERTIFIED SOLUTION
Avatar of DeepBlueInVB
DeepBlueInVB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks so much, that is spot on what I want
um, i think i have a problem, as i clear the text from text1, it appears in text2 backwards, with the conversion of ascii.

it looks like this, assuming this is ascii.

text1=abcdefg
text2=abcdefg

once cleared

text1=
text2=abcdefggfedcba
sorry bout that!!!!

Private Sub Text1_Change()
    Text2.Text = fncModifyInput(Text1.Text)
End Sub


Private Function fncConvertChar(ByVal strInput As String) As String
    Select Case strInput
        Case "a"
            fncConvertChar = Chr(229)
        Case "b"
            fncConvertChar = Chr(230)
        'long list of cases here!!!!!!!
       
       
        Case Else
            'to take care of other chars left out
            fncConvertChar = strInput
   
    End Select
End Function

Private Function fncModifyInput(ByVal strInput As String) As String
    Dim strOut As String
    Dim i As Integer
    For i = 1 To Len(strInput)
      strOut = strOut & fncConvertChar(Mid(strInput, i, 1))
    Next i
    fncModifyInput = strOut
End Function

thanks, much better,

i was wondering, is it possible to give a scrollbar, within a text box colours?

is there like some code or something.
dont understand what is exactly required..
Very sorry,

What I meant was, you know how you can give a textbox the option to have a scrollbar, are you able to colour the scrollbar with code, there is no setting for it. This might even need some subclassing?