Solved

& Character

Posted on 2003-12-02
4
184 Views
Last Modified: 2010-05-01
Simple question, but my brains gone numb and I cant think of the code I need!

Im getting data from a database that has a & in it. E.g. One & Two

However when I display this in a label it shows as One _ Two,

Any help much appreciated.
0
Comment
Question by:Terry Rogers
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 9856668
I guess you'll have to replace every & character by 2 &-characters. Give it a try and let me know what you get then....
0
 
LVL 6

Accepted Solution

by:
rvooijs earned 100 total points
ID: 9856678
Hi,

If you want this text to be displayed in a label, you will have to replace the & with &&.

something like:
    myLabel.caption = replace(myText, "&", "&&").

One other option would be to use a textbox in stead of a label. Make the background transparent, disable and lock it, and it behaves like a label.

Any good ?

Robert
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 9857007
Didn't I say exactly the same thing ?
0
 

Expert Comment

by:josebirla
ID: 9857124
make a condition just before in order to find out the precense of & in the field and use replace function


eg.  if instr(1, rs(fieldName).value, '&') then
              str=replace(rs(fieldName).value, "&", "&&")
      else
             str= rs(fieldName).value
      end if
     label1.caption=str


   
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 78
MS Access - Capture pressed key onclick 4 33
passing a value with stream reader AFTER a ";" 3 67
MsgBox 4 61
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

803 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