ListBox cellclick is firing even without cellclick

I have the following in the CellClick event handler for a listBox:

If Me.Selected(row) Then winGamerProfile.ShowModalWithin(winMain) End If

Problem is that it is firing while the Listbox is being populated (without a mouse click…). This causes the modal window to popup once for each row added to the listbox. I tried moving that code to CellAction event handler but had the same issue.


EDIT: Weird. I removed the winGamerProfile.Show code and the window still pops up. Could it be because I’m doing things like this:

if platform <> "PC" Then winGamerProfile.btnAddFriend.Visible = TRUE else winGamerProfile.btnAddFriend.Visible = FALSE end if
This code is in winMain

Yes. You’re using implicit instantiation, so any reference to the window will cause it to be created and if its Visible property is checked in the IDE, it will be shown.

so to get around this I created a method that sets all the window controls as I expect them, then shows the window. It seems to work.