Solved

Paste Special Character into TextBox

Posted on 2006-06-14
22
3,810 Views
Last Modified: 2013-12-03
I have a regular vb app and i wanna paste from a document into a textbox for example a Russian letter. I get a ? in the textbox instead.

I know about the RichTextBox but im not changing a 1000 textboxes.

Thanks
0
Comment
Question by:Mikal613
  • 9
  • 9
  • 2
  • +1
22 Comments
 
LVL 8

Accepted Solution

by:
List244 earned 500 total points
ID: 16904240
The problem I would guess is the font setting.  If the character is not in the selected font for the textbox it will not show.
The reason a rich text box would be able to do this, is it can change the font for just one character, a textbox can not.

I would suggest just switching to the rich text box.  You could open the project, press control + T, find Microsoft Rich
Text Box Control, add it, then close the project.

Create a new project with ONLY a module, no form.  Add this code:

Option Explicit
Public Sub Main()
Dim temp() As String
Dim File As String
temp = Split(Command$, """ """)
Dim I As Long
For I = 0 To UBound(temp)
    temp(I) = Replace(temp(I), """", "")
    Open temp(I) For Binary As #1
        File = Space(LOF(1))
        Get #1, , File
    Close #1
    File = Replace(File, "Begin VB.TextBox", "Begin RichTextLib.RichTextBox")
    Open temp(I) For Output As #1
        Print #1, File
    Close #1
Next I
End Sub

Then you can drag your form files to the EXE that creates and it will make all your text boxes RTF boxes.  It however
will not work perfectly.  It can be altered to be better.. but that is a good start.  The main problem with this is that
RTFs store their text in the Form.Frx file, so you will lose any default texts.
0
 
LVL 48

Author Comment

by:Mikal613
ID: 16905020
The font is installed
0
 
LVL 8

Expert Comment

by:List244
ID: 16905119
The font may be installed, but it must be set in the textbox.  A standard textbox may only hold one font at a time.  So unless
it is set to that font, it will be unable to display the character.  The RTF boxes differ from this in the way that they can display
multiple fonts at one time.  This is why it necessary to use another type of textbox.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
LVL 9

Expert Comment

by:Naveen Swamy
ID: 16910703
you want to make an multilingual application,

locale, fonts and charset are all included in this topic
 
0
 
LVL 48

Author Comment

by:Mikal613
ID: 16910716
A textbox can have more than one font. IF you press alt shift it changes fonts with keeping the previous characters.
0
 
LVL 8

Expert Comment

by:List244
ID: 16911867
Mika, which language are you using?  Visual Basic 6?  .NET 2003?  2005?

I have never seen nor heard of this alt+shift for changing fonts.  And in Visual Basic 6, the standard text box
can only hold one font at a time.  Changing a font in a standard text-box changes the font of the entire box.
0
 
LVL 48

Author Comment

by:Mikal613
ID: 16911990
vb6

Yes when you press alt shift it changes the font.
0
 
LVL 8

Expert Comment

by:List244
ID: 16912046
Milka, this does not happen when I press alt + shift.  Which OS are you running?  And like stated previously a change
in font should change the entire box.  This is why you can't paste just one special character, the box does not know
how to display it in the current font-setting.  This is why we have the Rich Text File boxes, so that we may add multiple
fonts colors and settings.
0
 
LVL 48

Author Comment

by:Mikal613
ID: 16912093
open a new project

add a textbox

write some alpha characters
press alt shift
write some alpha characters
press alt shift again
write some alpha characters
press alt shift again
write some alpha characters
press alt shift again

and youll see the font change
0
 
LVL 8

Expert Comment

by:List244
ID: 16912116
Again, this does not do anything for me.  Which OS are you running?
0
 
LVL 8

Expert Comment

by:List244
ID: 16912120
Can you post a screenshot somewhere to show what you see?
0
 
LVL 48

Author Comment

by:Mikal613
ID: 16912138
here is my regular font руку шы ьн туц ащте вщ нщг дшлу ше,,,

Like that exactly
0
 
LVL 48

Author Comment

by:Mikal613
ID: 16912379
woooo thats amazing when i wrote it it looked differntly.

It seems the EE database is using varchar and not nvarchar because it converted my string.
0
 
LVL 9

Expert Comment

by:justchat_1
ID: 16925066
you need to add unicode support  to your textboxes(google it) and ensure that their default font is the one that displays those characters.
0
 
LVL 48

Author Comment

by:Mikal613
ID: 17292089
im waiting for something that i can actually use.

Sorry dan im gonna send this to CS
0
 
LVL 8

Expert Comment

by:List244
ID: 17292099
Mika, again, why not use a Rich Text Box?  I am telling you the standard box only supports one font.
0
 
LVL 48

Author Comment

by:Mikal613
ID: 17292119
"I know about the RichTextBox but im not changing a 1000 textboxes."
0
 
LVL 8

Expert Comment

by:List244
ID: 17292133
I gave you code that would allow you to make an EXE that would allow FRM files to be dragged into it for
running, and it would fix them for you.
0
 
LVL 48

Author Comment

by:Mikal613
ID: 17292393
im not gonna rely on that. I have 1800 clients
0
 
LVL 8

Expert Comment

by:List244
ID: 17292401
Heh, 1800 clients, thousands of textboxes, and rather than try, you just let the months pass by.  No offense, but you could have
been done by now.
0
 
LVL 9

Expert Comment

by:justchat_1
ID: 17293806
its not as hard to change text boxes (to richtext) as you think:
open a vbp file in notepad and use the find/replace function
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Windows 10 start screen issues 9 55
Excel Automation VBA 19 88
VBA - If Bookmark = "XXBOOKMARKXX" then 15 40
MS SQL Update query with connected table data 3 38
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 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