Solved

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

Posted on 2008-10-13
5
563 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
[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
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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