How do i add a unicode to my text string?

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
very simple for you lot. I have Two text boxes and one button.

This is the code that is sued when button is clicked. HERE is where the unicode should be.
VB.NET:
            Dim x, y
            x = txtNick.Text
            y = "HERE" & x

            txtCopy.Text = y

When i click the button i want the txtCopy.text to display the unicode first. Then the txtNick

example:

ބSam

I am not sure what unicode i want to use yet. but for example the unicode i used there was U+0784.

But i googled and not sure how to use unicodes. I might add a text box called txtCode.text so the user can add any code like U+0784

thank you. sam
 
I assume you are asking how to convert the numeric code to a character, because if not you can write or paste those chars directly in code or textbox, .Net and VS fully support unicode.

0784 is a hex string, ie a string representing a 16-base number, this can be converted to an integer value with Convert class, then you can use the ConvertFromUtf32 method of Char type to convert the integer to a char.
VB.NET:
Me.TextBox1.Text = "ބ" & Char.ConvertFromUtf32(Convert.ToInt32("0784", 16))
 
I assume you are asking how to convert the numeric code to a character, because if not you can write or paste those chars directly in code or textbox, .Net and VS fully support unicode.

yes that is what im trying to do. convert numeric to a char.

I'm really sorry i did not explain myself well.(im veyr new to vb)

Forget my project one sec. I just open a new one.

I made 1 textbox, 1 button. Is there a way for me to add any 02B0, 02B1, 02B2 of the hex code in to text1.text and when the button is clicked it will convert the hex into the char?

sam
 
I see after posting you are using .Net 1.1 version, ConvertFromUtf32 was not added until a few framework versions ago, so you have to use this instead:
VB.NET:
Dim c As Char = Convert.ToChar(Convert.ToInt32("0784", 16))
In place of the "0784" string you can use teh text1.text string.
 
Yay it's working.

Sorry i'm not very good so when something works it's good for me.

whats this about my netframe work version? should i upgrade or something?

thank you very much
 
Last edited:
whats this about my netframe work version? should i upgrade or something?
I would, and I did :) The VB Express 2008 version that I am using is free, it is limited in features, but for my needs I've managed well with it so far. For you being new to VB, no doubt you should start with the current version.
 
But im using vb express 2008
Your forum profile info is set to VS 2003:
Johnson
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
Please update it so people can give relevant advice for what you ask.
 
Back
Top