Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default listbox click event question

I am using Excel 2003. I have a two userforms, one with a listbox and
one with a commandbutton. The click event of the listbox on userform1
hides the userform1 and shows userform2. The commandbutton on
userform2 unloads userform2 and shows userform 1.

It works exactly as I want it for the first click of the listbox;
however, after the commandbutton on userform2 is clicedk to close
userform2 and show userform1, the click event on the listbox does not
fire.

This is initiating code

Sub test()
UserForm1.Show
End Sub

This is the code for the listbox

Private Sub ListBox1_Click()
Me.Hide
UserForm2.Show
End Sub

This is the code for the commandbutton

Private Sub CommandButton1_Click()
Unload Me
UserForm1.Show
End Sub

When I change it so userform1 is unloaded, not just hidden, it works
repetitively. I prefer not to unload userform1 because there is a
significant amount of data loaded and takes a few second each time.

Can anyone explain why this event is not triggered after the first
iteration of hiding and then redisplaying?

Thanks

Ken
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default listbox click event question

That doesn't seem to help. When I get back to userform1, the click
event still doesn't fire when I click on the listbox. Also, now I
have to close the second userform twice before I get back to the first
userform; and I don't see the reason for that.

thanks

Ken

On Jan 11, 4:21*pm, "michdenis" wrote:
Hi,

try this :

Private Sub CommandButton1_Click()
* * Me.Hide
* * UserForm1.Show
* * Unload Me
End Sub

"Ken" a crit dans le message de groupe de discussion :
...
I am using Excel 2003. I have a two userforms, one with a listbox and
one with a commandbutton. *The click event of the listbox on userform1
hides the userform1 and shows userform2. *The commandbutton on
userform2 *unloads userform2 and shows userform 1.

It works exactly as I want it for the first click of the listbox;
however, after the commandbutton on userform2 is clicedk to close
userform2 and show userform1, the click event on the listbox does not
fire.

This is initiating code

Sub test()
* * *UserForm1.Show
End Sub

This is the code for the listbox

Private Sub ListBox1_Click()
* * Me.Hide
* * UserForm2.Show
End Sub

This is the code for the commandbutton

Private Sub CommandButton1_Click()
* * Unload Me
* * UserForm1.Show
End Sub

When I change it so userform1 is unloaded, not just hidden, it works
repetitively. *I prefer not to unload userform1 because there is a
significant amount of data loaded and takes a few second each time.

Can anyone explain why this event is not triggered after the first
iteration of hiding and then redisplaying?

Thanks

Ken


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default listbox click event question

You could use a combobox or

If you want to use a listbox, you will be obliged to use
an other event such as these : ListBox1_DblClick_Change or
ListBox1_DblClick

For a reason i do not know, listbox1_click is not triggered when
Userform1 is activated a second time..

it works !
'-----------------------------
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Me.Hide
Me.TextBox1.SetFocus
UserForm2.Show
End Sub
'-----------------------------





"Ken" a écrit dans le message de groupe de discussion :
...
That doesn't seem to help. When I get back to userform1, the click
event still doesn't fire when I click on the listbox. Also, now I
have to close the second userform twice before I get back to the first
userform; and I don't see the reason for that.

thanks

Ken

On Jan 11, 4:21 pm, "michdenis" wrote:
Hi,

try this :

Private Sub CommandButton1_Click()
Me.Hide
UserForm1.Show
Unload Me
End Sub

"Ken" a crit dans le message de groupe de discussion :
...
I am using Excel 2003. I have a two userforms, one with a listbox and
one with a commandbutton. The click event of the listbox on userform1
hides the userform1 and shows userform2. The commandbutton on
userform2 unloads userform2 and shows userform 1.

It works exactly as I want it for the first click of the listbox;
however, after the commandbutton on userform2 is clicedk to close
userform2 and show userform1, the click event on the listbox does not
fire.

This is initiating code

Sub test()
UserForm1.Show
End Sub

This is the code for the listbox

Private Sub ListBox1_Click()
Me.Hide
UserForm2.Show
End Sub

This is the code for the commandbutton

Private Sub CommandButton1_Click()
Unload Me
UserForm1.Show
End Sub

When I change it so userform1 is unloaded, not just hidden, it works
repetitively. I prefer not to unload userform1 because there is a
significant amount of data loaded and takes a few second each time.

Can anyone explain why this event is not triggered after the first
iteration of hiding and then redisplaying?

Thanks

Ken


  #5   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default listbox click event question

I already use the double click event for some other functionality. I
guess I will have to come up with another work around; I'll probably
go back to unloading then reloading the form.

Thanks for you help.

Ken




On Jan 11, 5:39*pm, "michdenis" wrote:
You could use a combobox or

If you want to use a listbox, you will be obliged to use
an other event such as these : ListBox1_DblClick_Change or
*ListBox1_DblClick

For a reason i do not know, listbox1_click is not triggered when
Userform1 is activated *a second time..

it works !
'-----------------------------
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Me.Hide
Me.TextBox1.SetFocus
UserForm2.Show
End Sub
'-----------------------------

"Ken" a écrit dans le message de groupe de discussion :
...
That doesn't seem to help. *When I get back to userform1, the click
event still doesn't fire when I click on the listbox. *Also, now I
have to close the second userform twice before I get back to the first
userform; and I don't see the reason for that.

thanks

Ken

On Jan 11, 4:21 pm, "michdenis" wrote:



Hi,


try this :


Private Sub CommandButton1_Click()
* * Me.Hide
* * UserForm1.Show
* * Unload Me
End Sub


"Ken" a crit dans le message de groupe de discussion :
...
I am using Excel 2003. I have a two userforms, one with a listbox and
one with a commandbutton. *The click event of the listbox on userform1
hides the userform1 and shows userform2. *The commandbutton on
userform2 *unloads userform2 and shows userform 1.


It works exactly as I want it for the first click of the listbox;
however, after the commandbutton on userform2 is clicedk to close
userform2 and show userform1, the click event on the listbox does not
fire.


This is initiating code


Sub test()
* * *UserForm1.Show
End Sub


This is the code for the listbox


Private Sub ListBox1_Click()
* * Me.Hide
* * UserForm2.Show
End Sub


This is the code for the commandbutton


Private Sub CommandButton1_Click()
* * Unload Me
* * UserForm1.Show
End Sub


When I change it so userform1 is unloaded, not just hidden, it works
repetitively. *I prefer not to unload userform1 because there is a
significant amount of data loaded and takes a few second each time.


Can anyone explain why this event is not triggered after the first
iteration of hiding and then redisplaying?


Thanks


Ken- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox Click Event BHatMJ Excel Discussion (Misc queries) 6 June 21st 07 09:34 PM
listbox click event help Michael Malinsky Excel Programming 4 December 23rd 05 09:27 PM
Click event on listbox IanC Excel Programming 2 April 5th 05 07:05 AM
click event on listbox CStephenson Excel Programming 1 March 22nd 05 06:21 PM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 09:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"