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: 3834
  • Last Modified:

Paste Special Character into TextBox

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
Mikal613
Asked:
Mikal613
  • 9
  • 9
  • 2
  • +1
1 Solution
 
List244Commented:
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
 
Mikal613Author Commented:
The font is installed
0
 
List244Commented:
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
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.

 
Naveen SwamyYash Infinite Solutions Private LimitedCommented:
you want to make an multilingual application,

locale, fonts and charset are all included in this topic
 
0
 
Mikal613Author Commented:
A textbox can have more than one font. IF you press alt shift it changes fonts with keeping the previous characters.
0
 
List244Commented:
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
 
Mikal613Author Commented:
vb6

Yes when you press alt shift it changes the font.
0
 
List244Commented:
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
 
Mikal613Author Commented:
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
 
List244Commented:
Again, this does not do anything for me.  Which OS are you running?
0
 
List244Commented:
Can you post a screenshot somewhere to show what you see?
0
 
Mikal613Author Commented:
here is my regular font руку шы ьн туц ащте вщ нщг дшлу ше,,,

Like that exactly
0
 
Mikal613Author Commented:
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
 
justchat_1Commented:
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
 
Mikal613Author Commented:
im waiting for something that i can actually use.

Sorry dan im gonna send this to CS
0
 
List244Commented:
Mika, again, why not use a Rich Text Box?  I am telling you the standard box only supports one font.
0
 
Mikal613Author Commented:
"I know about the RichTextBox but im not changing a 1000 textboxes."
0
 
List244Commented:
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
 
Mikal613Author Commented:
im not gonna rely on that. I have 1800 clients
0
 
List244Commented:
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
 
justchat_1Commented:
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

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
  • 9
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now