SelectedIndex not member of DesktopListBox

I am working through a simple two texts, button and listbox trying to save two texts during an Add Row code. The following was pasted directly from Xojo information.

This example project consists of a two-column DesktopListBox and two DesktopTextField creates a new row in the DesktopListBox and adds the contents of the DesktopTextField</api/user_interface/desktop/desktoptextfield>s to the DesktopListBox.

PeopleList.CellTextAt(PeopleList.LastAddedRowIndex, 0) = FirstNameField.Text
PeopleList.CellTextAt(PeopleList.LastAddedRowIndex, 1) = LastNameField.Text
PeopleList.SelectedIndex = PeopleList.LastAddedRowIndex ’ select the newly added row

I get an error in the 2nd from bottom line at PeopleList.SelectedIndex. The message is "DesktopBox has no member named “SelectedIndex”. Can’t find information as to why is an example in the DesktopListBox section but does not work. Have found 5 “Page Not Found” trying to work this out. Can anyone point me to an answer? I’d appreciate it. Thank you. Jim Backus

It should be SelectedRowIndex not SelectedIndex.

1 Like

I created a bug report for this:
#76315 - Documentation: DesktopListBox example has SelectedIndex instead of SelectedRowIndex

1 Like

Good morning. Thank you Wayne and AlbertoD for the quick responses.

Hmmmm. Too many people not bothering to read the documentation that might allow then to figure it out for themselves, it seems to me.

The documentation is wrong here, our friend read it and did what was explained.

Hmmmmm, it seems some people answer without read all the topic :smiley: :smile:.

1 Like