?
Solved

Converting text into symbol characters.

Posted on 2003-03-25
17
Medium Priority
?
237 Views
Last Modified: 2013-12-03
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
Comment
Question by:darkmoon_soft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 2
  • +1
17 Comments
 
LVL 11

Expert Comment

by:supunr
ID: 8208456
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
 
LVL 11

Expert Comment

by:supunr
ID: 8208464
to set the font at run time...

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

0
 

Author Comment

by:darkmoon_soft
ID: 8208481
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
Industry Leaders: 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!

 

Author Comment

by:darkmoon_soft
ID: 8208486
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
 
LVL 1

Expert Comment

by:hazgod
ID: 8208726
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
 

Author Comment

by:darkmoon_soft
ID: 8209560
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
 
LVL 1

Expert Comment

by:DeepBlueInVB
ID: 8209823
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
 

Author Comment

by:darkmoon_soft
ID: 8209848
great, so far, how would I make heaps of them, one for each character?

thanks
0
 
LVL 1

Expert Comment

by:DeepBlueInVB
ID: 8209967
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
 

Author Comment

by:darkmoon_soft
ID: 8210004
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
 
LVL 1

Accepted Solution

by:
DeepBlueInVB earned 300 total points
ID: 8210020
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
 

Author Comment

by:darkmoon_soft
ID: 8210035
Thanks so much, that is spot on what I want
0
 

Author Comment

by:darkmoon_soft
ID: 8210852
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
 
LVL 1

Expert Comment

by:DeepBlueInVB
ID: 8211109
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
 

Author Comment

by:darkmoon_soft
ID: 8211733
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
 
LVL 1

Expert Comment

by:DeepBlueInVB
ID: 8215951
dont understand what is exactly required..
0
 

Author Comment

by:darkmoon_soft
ID: 8216666
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question