Row -2147483648

I have a ListBox1.

It has a few rows populated. When I click on a ListBox1.CellClick -->MsgBox str(me.Index)

I get “-2147483648” this is unexpected. Can anyone tell me what is going on here?

And why don’t I get “0”? (Assuming I’m on row zero of course)

The command is me.listindex.

OK. They what is .row and why does it return -2147483648?

OK. They what is .row and why does it return -2147483648?

In your example, you were using me.index, not me.row. me.index returns that value because your control is not part of a control set. It is only meaningful when the control is in a control set, which is a collection of entire controls.

When I try it, there is no such field as me.row. The arguments passed to CellClick include a variable named row (not me.row) that is the zero-based row within the listbox of the row you clicked on:

In the event CellClick, I put this line of code to display into a text area:

textarea1.AppendText "CellClick row= " + trim(str(row)) + "  column= " + trim(str(column)) +" x= " + trim(str(x)) +" y=" + trim(str(y)) + " me.index= " + trim(str(me.index)) + " me.Listindex= " + trim(str(me.ListIndex)) + EndOfLine

Then when I click in the listbox, I get this output:

CellClick row= 0 column= 0 x= 50 y=12 me.index= -2147483648 me.Listindex= -1 CellClick row= 1 column= 0 x= 60 y=9 me.index= -2147483648 me.Listindex= 0 CellClick row= 0 column= 0 x= 48 y=8 me.index= -2147483648 me.Listindex= 1 CellClick row= 1 column= 0 x= 47 y=4 me.index= -2147483648 me.Listindex= 0 CellClick row= 0 column= 0 x= 42 y=7 me.index= -2147483648 me.Listindex= 1

Notice that me.Listindex does not start out the same value as row. That is because Listindex is the selected item number. Before the click processing completes the first time, no item was selected, hence it returned -1. But row (the argument passed to CellClick) does accurately show which row I clicked on.

That is the control index in an array. Controls which are not part of an array have the index -2147483648.

Chrisitan: Thanks for that. BUt my over curios self want to know why 2147483648 and not 2147483647? (Or -1!)

Not sure why it went to that number but -2147483648 is the lowest possible value that can be expressed by a 32 bit signed integer.