FancyPrairie
Programmer
I have a listbox that is the size (width and height) of the Detail section. I have 2 buttons ("Save and Close" "Cancel") located in the Form's footer section. Both the Vertical Anchor property and the Horizontal property of the listbox is set to 2 (both). In the on Resize event of the form, I attempt to keep the buttons centered as the form is resized.
The form's Border Style property is set to "Sizable". When I resize the form by dragging one of the sides of the form with the mouse, the listbox will resize to the size of the form, as expected. If I select, say 3 items, on the listbox and resize the form (i.e. make it wider than narrower by dragging the mouse) the 3 items that were selected eventually become unselected as I'm resizing.
It appears that when I change the horizontal position of the buttons (via the Form_Resize event), the 3 items that were selected become unselected.
Is there something I'm doing wrong? Or is this a bug in Access?
Here's the code in the Form_Resize event
The form's Border Style property is set to "Sizable". When I resize the form by dragging one of the sides of the form with the mouse, the listbox will resize to the size of the form, as expected. If I select, say 3 items, on the listbox and resize the form (i.e. make it wider than narrower by dragging the mouse) the 3 items that were selected eventually become unselected as I'm resizing.
It appears that when I change the horizontal position of the buttons (via the Form_Resize event), the 3 items that were selected become unselected.
Is there something I'm doing wrong? Or is this a bug in Access?
Here's the code in the Form_Resize event
Code:
Private Sub Form_Resize()
Dim x As Long
x = (Me.InsideWidth / 2) - (((cmdCancel.left + cmdCancel.Width) - cmdOk.left) / 2)
If (x > 0) And (x + (cmdCancel.left - cmdOk.left)) >= (cmdCancel.left - cmdOk.left) Then
cmdCancel.left = x + (cmdCancel.left - cmdOk.left)
cmdOk.left = x
End If
DoEvents
End Sub