Selecting Row In ListBox "Locks Up" Form?

P

PeteCresswell

Here's the code, which attempts to select the first row in a list box.

It executes without throwing an error, but then the entire form seems
tb "locked up" in that nothing even responds to a mouse click - not
even the buttons.

Rem out line 3020, and the form accepts mouse clicks.

Un-rem it again and the form locks up.

Anybody seen this before?
------------------------------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
3000 debugStackPush Me.Name & ": Form_Open"
3001 On Error GoTo Form_Open_err

' PURPOSE: - To restore the form's location/size from last time
' - To load the first item on the list

3010 FormDimensions_Apply Me, CurrentUserGet()

3020 lstChanges.Selected(0) = True
3029 lstChanges_AfterUpdate

'3999 Me.txtChangeDetail.SetFocus

Form_Open_xit:
DebugStackPop
On Error Resume Next
Exit Sub

Form_Open_err:
BugAlert True, ""
Resume Form_Open_xit
End Sub
----------------------------------------------------------------------------------------------------------------
 
P

Peter Hibbs

Pete,

Certainly have.

Try this -

lstChanges.SetFocus
lstChanges.Selected(0) = True
lstChanges_AfterUpdate
....

HTH

Peter Hibbs.
 
P

PeteCresswell

Just for the record: both Peter's and Stephen's solutions worked.

Stephen: Your observation about not all controls being fully
instantiated in Open may explain a couple of other problems I've had
over the years.

Thanks to both Peter and Stephen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top