PDA

View Full Version : ListBox Troubles


sside
12-26-2003, 11:29 PM
Hi there,

I'm trying to put 2 values into itemtext (listbox items).
For example; first value the time, and second value some text or date.

time = System.GetTime(TIME_FMT_MIL);
ListBox.AddItem("ListBox1", time, "Some text.");

It seems these two values can't get along. The first value shows up the second doesn't.:mad:

I tried to do the same with the paragraph but same results, the first value shows up the second doesn't. How can i put more than one value (different than text) into paragraph, input object or listbox?

Does anybody knows how this problem can be solved?

Thank you.

Corey
12-27-2003, 12:01 AM
Hi. You can concatenate a variable to a string by using the .. operator, i.e.:

firstName = "John";
Dialog.Message("Message Title", firstName, " is your first name.");

doesn't work... The correct way is:

firstName = "John";
Dialog.Message("Message Title", firstName.." is your first name.");

Try it out, this will display a message box with the text "John is your first name."... You can pretty much freely concatenate values like that wherever you like...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

sside
12-27-2003, 12:25 AM
Well thank you

It works.:)

Corey
12-27-2003, 12:43 AM
Cool...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

sside
12-27-2003, 12:52 AM
Hello Corey,

Thank you for your help.

Another thing, what you gave me works fine :) but when i do this;
ListBox.AddItem("ListBox1", date.. time.. "some text", "");
i get this; (12/27/200307:44:50some text).:D
Surely must be some kind of ........... to make them split from each other but i don't know it. Would you tell it to me please?

Thank you

Corey
12-27-2003, 01:16 AM
Hi. No spaces between the .. and the quote i.e.:

Dialog.Message("Your Title", myDate..myTime.." is this...");

Or if you need to add a space:

Dialog.Message("Your Title", myDate.." "..myTime.." is this...");

Just FYI keep in mind when you are naming variables to avoid the reserved keywords, i.e. the following words are reserved and cannot be used for variable or function names:

and
break
do
else
elseif
end
false
for
function
if
in
local
nil
not
or
repeat
return
table
then
true
until
while

:)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

sside
12-27-2003, 01:31 AM
Thanks for your time.:)