Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


List Box Help

In a list box, i am showing the date, level, and score a child achieved on my game. How can i have the list box showing details in this format:

rather than this:

I think the basic question is, can i merge two items, into one value on the list?
Please help someone, i'm still fairly new to the vb arena!


  • the walrusthe walrus Member Posts: 249
    [b][red]This message was edited by the walrus at 2005-2-6 15:32:25[/red][/b][hr]
    if you posted your code i could show you where you're going wrong for certain, but my guess is that you're doing something like

    List1.AddItem "Date="
    List1.AddItem Date
    List1.AddItem "Level="
    List1.AddItem Level
    List1.AddItem "Score="
    List1.AddItem Score

    if so, change your code so that it looks like this

    List1.AddItem "Date=" & Date
    List1.AddItem "Level=" & Level
    List1.AddItem "Score=" & Score

    of course using your variable names instead of mine :). a note on what & means. & is vb's string concatenator. you may also see people concatenate strings with the + symbol, which works fine if the two things you are combining are both strings. the reason vb allows you to concatenate strings with + is for backwards compatability--in old versions of basic there was no & operator and + was the only way to concatenate strings. the problem with + is it's also used for addition and you can run into problems if you're not careful with it. something like [b]digit1 + digit2[/b], where digit1 is 3 and digit2 is 5, will obviously add the two numbers together and return 8, where as [b]digit1 & digit2[/b] will convert both variables into strings and then concatenate them, returning "35" instead of 8. this is very important because you may not always know the type of data you're working with, so using & as a string concatenator rather than + is a good habit to get into.

  • nickhudson4evanickhudson4eva Member Posts: 2
    Thankyou very much, I tried something similar earlier today, but with no success, although I was using + instead of &. Now it works fine.

    Thanks again
Sign In or Register to comment.