Sending strings to Listboxes

  • Thread starter Thread starter JimmyX
  • Start date Start date
J

JimmyX

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???????
 
JimmyX said:
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???????

Apart from the fact that the & operator should be used to concatenate
strings, I can not reproduce the problem. First code gives "abcxyz".


Armin
 
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???????

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
 
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.

rowe_newsgroups said:
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 via DotNetMonster.com said:
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
 
Back
Top