If I try to add a string to a string variable and display it in a listbox,
the string does not display
Strng="abc"
listbox1.items.add(Strng+"xyz")
The resulting display is abc
But if I do it the other way around:
Strng="abc"
listbox1.items.add("xyz"+Strng)
It displays correctly
The resulting display is xyzabc
Why does this happen???????
Armin Zingler - 04 Oct 2007 01:55 GMT
> If I try to add a string to a string variable and display it in a
> listbox, the string does not display
[quoted text clipped - 12 lines]
>
> Why does this happen???????
Apart from the fact that the & operator should be used to concatenate
strings, I can not reproduce the problem. First code gives "abcxyz".
Armin
rowe_newsgroups - 04 Oct 2007 11:39 GMT
> If I try to add a string to a string variable and display it in a listbox,
> the string does not display
[quoted text clipped - 12 lines]
>
> Why does this happen???????
First off, do you have Option Explicit On? Or did you just not share
with use the declaration for the variable Strng?
Thanks,
Seth Rowe
JimmyX - 04 Oct 2007 15:18 GMT
Option Explicit is on. Since I posted this e-mail, I noticed that some string
variables don't cause this
problem. The string cvariable that I'm using is in an array and was read as
Bytes from a binary file.
>> If I try to add a string to a string variable and display it in a listbox,
>> the string does not display
[quoted text clipped - 8 lines]
>
>Seth Rowe
Armin Zingler - 04 Oct 2007 18:29 GMT
> Option Explicit is on. Since I posted this e-mail, I noticed that
> some string variables don't cause this
> problem. The string cvariable that I'm using is in an array and was
> read as Bytes from a binary file.
Probably there is a chr(0) in it.
Armin
JimmyX - 07 Oct 2007 20:16 GMT
That was the problem! Thanks so much for your help.
Jimmy
>> Option Explicit is on. Since I posted this e-mail, I noticed that
>> some string variables don't cause this
[quoted text clipped - 4 lines]
>
>Armin