[AccessD] Form hangs when setting listbox selected index

Christopher Jeris cjeris at fas.harvard.edu
Tue Jun 12 15:41:05 CDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Susan Harkins wrote:
> ========Are you positive that the preceding code is truly populating the
> listbox? 

The items appear in it; but as I said in a later message, the failure
still occurs if I instead bind the Row Source of the listbox to the same
table, and don't try to use VB code to populate the listbox.

Without the line
  Me!List0.Selected(0) = True
in the Form_Open event handler, the listbox functions perfectly
normally, and it is even possible to create a command button which
advances the listbox selected index by VB code:

' this works just fine, as long as you don't kill it by trying to set
' the selected item in Form_Open
Private Sub Command2_Click()
    If Me!List0.Selected(0) Then
        Me!List0.Selected(1) = True
    ElseIf Me!List0.Selected(1) Then
        Me!List0.Selected(2) = True
    ElseIf Me!List0.Selected(2) Then
        Me!List0.Selected(0) = True
    End If
End Sub

Setting the selected item in the Load event, rather than the Open event,
seems superficially to work; but why should that be?  I'm reluctant to
trust it without understanding the reason for this behavior.

thanks,
Chris Jeris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGbwTh5ICCNV0oGWARAmniAJ0Y/vlT0IY2BbCtteWlqbGXUiRb0wCdH/rF
RPMR7K2q5OWMZaEBNl4HB0Y=
=0qwC
-----END PGP SIGNATURE-----



More information about the AccessD mailing list