?
Solved

How can I activate a button control that does not have a Value property

Posted on 2004-11-26
6
Medium Priority
?
163 Views
Last Modified: 2010-05-02
Hi

I have an application that uses a user-defined OCX enhanced button.  I want the On_Click event of one of these buttons to activate the On_Click event of another button, although this particular command button does not have a Value property - Using the conventional vb button control I could simply say

cmdButton2.Value = True

 in order to activate it - how can I achieve same in my scenario.

Thanks in advance
0
Comment
Question by:icontroldev
  • 2
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 200 total points
ID: 12681565
You can call the method directly:

Sub cmdButton1_Click()
   
    Call cmdButton2_Click()

End Sub
0
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 12681753
A more oo approach would be to create a public method, place the button click event handler code into it and call it from both button click events. The other advantage to this is that you won't get tangled up in your error handling routines if you use vb "bubble-up" error handling.
0
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 13468634
Well Erick37's approach was correct, but I believe my answer has merit too.
0
 
LVL 32

Expert Comment

by:Erick37
ID: 13468804
Actually my approach was just poor programming practice
:o)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question