problem with MsgBox

I’m having an issue with MsgBox
I am getting an error “this item does not exisit”
when using the following

MsgBox JobsList.ListIndex

where JobsList Is a ListBox

also i get the following results when single clicking on a cell

[code] Dim JobsDatFile As String

JobsDatFile = JobsList.List(JobsList.ListIndex)

MainWin.CusIDstatus.Text = JobsDatFile

MsgBox JobsDatFile[/code]

the results is multiple strings of data from the ListBox instead of single strings.
151150171233.dat
151222043122.dat

i am looking for ListBox.list(number) to return only a single string value

currently i have no licence.

anyone who might know maybe i am doing something wrong.

thank you…

First off… JobsList (the listbox) must be in the same scope as where the MSGBOX statement is (a module on the same window for example).
Second Listindex is an INTEGER value, so even if it could “find the item” you’d get a “type mismatch”
The statement would have to be

MsgBox Str(JobsList.Listindex)

I suggest you read the documention a bit more closely then come back with you come up with

basically your issue is not with MSGBOX but iwth LISTBOX

Listindex is an integer and MsgBox excepts a string. Xojo is a strong type cast language so you have to covert from integer to string. Something like this:

msgbox Str(JobsList.ListIndex)

I also cringe when I see a String named JobsDatFile.

If you see JobsDatFile 6 months later would you think it is a String or a File?

It is a good idea to name variables well - it makes following and understanding code sooo much easier.

Dim JobsDatFileStr as string