?
Solved

& Character

Posted on 2003-12-02
4
Medium Priority
?
194 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 400 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

809 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