M
misted
Hi I am wondering if this is a bug or just poor programming from my
part. In its simplest form what appears to me as a bug occurs when
there are 2 userforms. On UserForm1 we have a combobox with a
dropbuttonclick event code as:
Private Sub ComboBox1_DropButtonClick()
Me.Hide
UserForm2.Show
End Sub
Userform2 has a commandbutton coded as:
Private Sub CommandButton1_Click()
Me.Hide
UserForm1.Show
End Sub
First I load userform1. I click the dropdown button on the combobox,
userform2 appears. I press the commandbutton on userform2, and am
presented with userform1 again.
All good so far. However when I press the dropdownbutton again, the
click event is not fired.
I have switched the event to a doubleclick, which doesn't have this
problem, and works smoothly.
When switching the code for the dropbuttonclick event code to something
simple like msgbox "hello", and transfer the switching of forms to a
commandbutton, then there is no problem. The problem seems to be
linked to the hiding of the of the form and loading of another form
within the dropbuttonclick event.
If an additional button is added to the first form, UserForm1, which
hides the form, and another button is pressed (placed on a spreadsheet
perhaps) which shows the form again, the click event is funcitonal
again.
So it appears there is a reset that occurs with this hiding and showing
of the userform.
However I do not seem to be able to replicate this smoothly in the
click event code.
Any light that can be shed on this would be greatly appreciated. Even
if someone could confirm they get the same result / think its a bug as
opposed to poor programming, this would help alot.
I guess the double click event works, but isn't as elegant as a single
click on the dropdownbutton, which I would prefer to use. I am using
this to replicate a RefEdit control, but buggy as that is, I thought
I'd use the closest looking control.
Thanks for your help...
part. In its simplest form what appears to me as a bug occurs when
there are 2 userforms. On UserForm1 we have a combobox with a
dropbuttonclick event code as:
Private Sub ComboBox1_DropButtonClick()
Me.Hide
UserForm2.Show
End Sub
Userform2 has a commandbutton coded as:
Private Sub CommandButton1_Click()
Me.Hide
UserForm1.Show
End Sub
First I load userform1. I click the dropdown button on the combobox,
userform2 appears. I press the commandbutton on userform2, and am
presented with userform1 again.
All good so far. However when I press the dropdownbutton again, the
click event is not fired.
I have switched the event to a doubleclick, which doesn't have this
problem, and works smoothly.
When switching the code for the dropbuttonclick event code to something
simple like msgbox "hello", and transfer the switching of forms to a
commandbutton, then there is no problem. The problem seems to be
linked to the hiding of the of the form and loading of another form
within the dropbuttonclick event.
If an additional button is added to the first form, UserForm1, which
hides the form, and another button is pressed (placed on a spreadsheet
perhaps) which shows the form again, the click event is funcitonal
again.
So it appears there is a reset that occurs with this hiding and showing
of the userform.
However I do not seem to be able to replicate this smoothly in the
click event code.
Any light that can be shed on this would be greatly appreciated. Even
if someone could confirm they get the same result / think its a bug as
opposed to poor programming, this would help alot.
I guess the double click event works, but isn't as elegant as a single
click on the dropdownbutton, which I would prefer to use. I am using
this to replicate a RefEdit control, but buggy as that is, I thought
I'd use the closest looking control.
Thanks for your help...