Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List Box ADDITEM with
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00833485
Message ID:
00833490
Views:
16
It's documented in AddItem help that '\' is a special charcter:
The backslash ("\") is treated as a special character when used in the expression for an item. The following rules apply for this character:
  • You can disable an item in a list box or combo box by adding a single backslash to the beginning of the expression.
  • Any multiple of two backslashes used in the expression is displayed as a single backslash. For example, one or two backslashes used together will display as one, and three or four backslashes together will display as two. The following example code contains a list box item containing a Universal Naming Convention (UNC) path. The code displays in the list box as \\MyServer\MyMachine\MyFolder.
    MyForm.List1.AddItem("\\\\MyServer\\MyMachine\\MyFolder")
  • If the expression begins with multiple backslashes, the item is not disabled. If you want to disable an item that begins with multiple backslashes, add a backslash and a close bracket (]) to the beginning of the item. For example, the following disables the UNC path item in the list box.
    MyForm.List1.AddItem("\]\\\MyServer\\MyMachine\\MyFolder")
  • To include a separator line, use a backslash followed by a hyphen as the item to add to the list box. For example, the following code adds a separator line to a list box.
    MyForm.List1.AddItem("\-")

    >In adding all available printers to a listbox with the ADDITEM or ADDLISTITEM method, network printers have an identification of "\\...printer"
    >
    >I found it very interesting on how the listbox removes the first '\' when more than one is present.
    >
    >For example use the following
    >
    >
    >this.lst1.additem('\abc')
    >this.lst1.additem('abc\abc')
    >this.lst1.additem('\\abc')
    >this.lst1.additem('abc\\abc')
    >this.lst1.additem('\>
    >
    >Can anyone explain why this is happening??
    >Is there a simple solution other than coding to determine replace '\\' with '\\\' before adding?
    >
    >Thanks in advance
    --sb--
  • Previous
    Reply
    Map
    View

    Click here to load this message in the networking platform