PC Review


Reply
Thread Tools Rate Thread

Call Event as Sub

 
 
=?Utf-8?B?Q2xheW1hbg==?=
Guest
Posts: n/a
 
      7th Aug 2007
I have a need to force a ComboBox_Click() event. But, I think I already know
the answer - I just don't like it.

The ComboBox_Click() event populates a form. The user has the option to edit
some of the controls in the form. Some of these edits will change values in
other controls. Therefore, I would like to re-populate the form as if the
ComboBox was clicked.

The ComboBox_Change() event wasn't working in my situation. When I cleared
the ComboBox, it was kicking off the Change() event and I didn't want that.
This is why I used Click().

The answer I'm trying to avoid is create a sub that does everything in the
ComboBox_Click() event and call it from everywhere I need.
--
Adios,
Clay Harryman
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      7th Aug 2007
Clay,

You should be able to call the Combo box click event handler just like how
you would call any sub routine.

Private Sub ComboBox1_Click()
MsgBox "combo box 1 was clicked!"
End Sub

Sub test()
'Call ComboBox1_Click
ComboBox1_Click
End Sub



--
Hope that helps.

Vergel Adriano


"Clayman" wrote:

> I have a need to force a ComboBox_Click() event. But, I think I already know
> the answer - I just don't like it.
>
> The ComboBox_Click() event populates a form. The user has the option to edit
> some of the controls in the form. Some of these edits will change values in
> other controls. Therefore, I would like to re-populate the form as if the
> ComboBox was clicked.
>
> The ComboBox_Change() event wasn't working in my situation. When I cleared
> the ComboBox, it was kicking off the Change() event and I didn't want that.
> This is why I used Click().
>
> The answer I'm trying to avoid is create a sub that does everything in the
> ComboBox_Click() event and call it from everywhere I need.
> --
> Adios,
> Clay Harryman

 
Reply With Quote
 
=?Utf-8?B?Q2xheW1hbg==?=
Guest
Posts: n/a
 
      7th Aug 2007
Found the problem:
ComboBox_Click() was in another form than the one with which I had problems.
I made it Public rather than Private and it worked.
--
Adios,
Clay Harryman


"Vergel Adriano" wrote:

> Clay,
>
> You should be able to call the Combo box click event handler just like how
> you would call any sub routine.
>
> Private Sub ComboBox1_Click()
> MsgBox "combo box 1 was clicked!"
> End Sub
>
> Sub test()
> 'Call ComboBox1_Click
> ComboBox1_Click
> End Sub
>
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "Clayman" wrote:
>
> > I have a need to force a ComboBox_Click() event. But, I think I already know
> > the answer - I just don't like it.
> >
> > The ComboBox_Click() event populates a form. The user has the option to edit
> > some of the controls in the form. Some of these edits will change values in
> > other controls. Therefore, I would like to re-populate the form as if the
> > ComboBox was clicked.
> >
> > The ComboBox_Change() event wasn't working in my situation. When I cleared
> > the ComboBox, it was kicking off the Change() event and I didn't want that.
> > This is why I used Click().
> >
> > The answer I'm trying to avoid is create a sub that does everything in the
> > ComboBox_Click() event and call it from everywhere I need.
> > --
> > Adios,
> > Clay Harryman

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make double click event to call and execute the mouseup event code techsatish@gmail.com Microsoft VB .NET 2 25th Aug 2006 05:43 PM
How to make double click event to call and execute the mouseup event code techsatish@gmail.com Microsoft Dot NET Framework Forms 0 25th Aug 2006 04:26 AM
how do I call dataGridView_RowEnter event from within buttonSave_ Click event? hazz Microsoft C# .NET 2 8th Feb 2006 08:05 PM
Call javascript function without using any event call cschang Microsoft ADO .NET 3 1st Feb 2005 03:04 AM
Click event gets lost when call MSGBOX in leave event Tom Microsoft VB .NET 3 12th Jan 2005 09:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:01 PM.