Solved

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

Posted on 2008-10-13
5
476 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
Comment Utility
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
Comment Utility
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
Comment Utility
First of all, is this saved in a database? secondly is this web or windows?
0
 

Author Comment

by:gem56
Comment Utility
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
Comment Utility
No problem. I am glad to help out where I can.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

10 Experts available now in Live!

Get 1:1 Help Now