Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

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
0
darkmoon_soft
Asked:
darkmoon_soft
  • 9
  • 5
  • 2
  • +1
1 Solution
 
supunrCommented:
set the font of the text2 as "symbol" at design time.
then

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

Good Luck!
0
 
supunrCommented:
to set the font at run time...

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

0
 
darkmoon_softAuthor Commented:
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
darkmoon_softAuthor Commented:
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
0
 
hazgodCommented:
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
0
 
darkmoon_softAuthor Commented:
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.
0
 
DeepBlueInVBCommented:
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
0
 
darkmoon_softAuthor Commented:
great, so far, how would I make heaps of them, one for each character?

thanks
0
 
DeepBlueInVBCommented:
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
0
 
darkmoon_softAuthor Commented:
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?
0
 
DeepBlueInVBCommented:
sorry about double post... try this now

Private Sub Text1_Change()
    Text2.Text = Text2.Text & fncConvertChar(Right(Text1, 1))
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
0
 
darkmoon_softAuthor Commented:
Thanks so much, that is spot on what I want
0
 
darkmoon_softAuthor Commented:
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
0
 
DeepBlueInVBCommented:
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

0
 
darkmoon_softAuthor Commented:
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.
0
 
DeepBlueInVBCommented:
dont understand what is exactly required..
0
 
darkmoon_softAuthor Commented:
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?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now