Solved

How to enter ampersand (&) character in a TextBox without it being translated

Posted on 2008-10-13
5
507 Views
Last Modified: 2012-06-27
Hi,
When I enter (for example) "Fred & John" in a TextBox, save that text and later recall it by reloading the text box, the single ampersand (&) character is not shown but instead is interpreted as a control char.

If I enter "Fred && John" and do same as above then a single ampersand is shown on subsequent reload of that TextBox.

In the past I did something to basically inform the system to treat that character like any other but I forget now what I did. Any help?

/Michael
0
Comment
Question by:gem56
5 Comments
 
LVL 6

Accepted Solution

by:
tchamtieh earned 200 total points
ID: 22707725
Hi Michael,

I think you can just set the UseMnemonic attribute of a Label to "false" and see the magic. You might even be able to use the escape character as in \& but not so sure.

Good Luck.
0
 

Assisted Solution

by:Cosmos36
Cosmos36 earned 50 total points
ID: 22707953
How are you "saving" the text?

If you use a "string" variable, nothing should be changed when you write that variable back to the textbox. Example below:

1 Form
2 Buttons
1 Textbox

Public Class Form1
    Dim MyTextbox As String
    Private Sub BtnSaveAndClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSaveAndClear.Click

        MyTextbox = TextBox1.Text
        TextBox1.Clear()

    End Sub
    Private Sub BtnFillTextbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFillTextbox.Click

        TextBox1.Text = MyTextbox

    End Sub
End Class
0
 
LVL 6

Expert Comment

by:carlsiy
ID: 22708365
First of all, is this saved in a database? secondly is this web or windows?
0
 

Author Comment

by:gem56
ID: 22708603
Hi guys,
I must appologise for my poorly described question and limited testing, I was in a real hurry.

I actually entered the text in one dialog via a TextBox and later showed the entered text via a Label, incorrectly. Setting the UseMnemonic attribute to "false" did the trick so thank you all for responding and of course tchamtieh for the answer.

Thanks,

0
 

Expert Comment

by:Cosmos36
ID: 22718358
No problem. I am glad to help out where I can.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now