selected row count of list box

  • Thread starter Thread starter Keith G Hicks
  • Start date Start date
K

Keith G Hicks

A2k

Is there a way to get the selected row count of a list box dynamically as
the user selects rows? Delphi has an event called "OnSelectionChanged" but
Access is much more limited. I don't want the user to have to exit the list
box or click a button or anything manual in order to see the # of rows he's
selected. How can this be done?

I know about "lstCusts.ItemsSelected.Count" but not sure what event to use
it in to accomplish what I need.

Thanks,

Keith
 
Never mind. I did this and it handles both mouse and keyboard selections:

Private Sub lstCusts_AfterUpdate()
Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

Private Sub lstCusts_Click()
Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

Private Sub lstCusts_KeyUp(KeyCode As Integer, Shift As Integer)
Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub
 
Keith G Hicks said:
A2k

Is there a way to get the selected row count of a list box dynamically as
the user selects rows? Delphi has an event called "OnSelectionChanged" but
Access is much more limited. I don't want the user to have to exit the
list
box or click a button or anything manual in order to see the # of rows
he's
selected. How can this be done?

I know about "lstCusts.ItemsSelected.Count" but not sure what event to use
it in to accomplish what I need.

Use the listbox's OnClick event.
 
Keith G Hicks said:
Never mind. I did this and it handles both mouse and keyboard selections:

Private Sub lstCusts_AfterUpdate()
Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

Private Sub lstCusts_Click()
Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

Private Sub lstCusts_KeyUp(KeyCode As Integer, Shift As Integer)
Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

You really only need the click event. It responds to both kbd & mouse.
 
Back
Top