Hi,
I’m new to using Xojo and I’m currently going through the “Introduction to programming with Xojo” book.
I’m now at the chapter 8 (about object oriented programming) and I would like to know why I get an out of bounds exception if I double click anywhere in the Course listbox (if I double click on a row with a course it’s ok but anywhere else I got the error and I don’t understand why)
Thank you!
Looks like a step should probably be added in there somewhere. Essentially you don’t want the code in the Change event to run if you don’t have a row selected. There are two ways to fix this:
- Click on CourseBox and in the Inspector, turn the RequiresSelection property to ON.
or
- At the beginning of the CourseBox.Change event handler, add this line of code:
If Me.ListIndex < 0 Then Return
Hi Paul,
I tried your 2 solutions and it worked like a charm.
After trying both solutions, I think that number 2 is the best way to go (for me) because with number 1It’s select the last course on the listbox if I double click anywhere in it and with number 2 it does nothing. (sorry if it’s not clear, english is not my first language lol)
Thank you very much for your answer Paul!