Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

Sending strings to Listboxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JimmyX - 03 Oct 2007 23:31 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.