|
-
Feb 1st, 2002, 08:28 AM
#1
Thread Starter
Fanatic Member
Click
How can I call a click procedure of a command button from another form?
-
Feb 1st, 2002, 08:34 AM
#2
Fanatic Member
u cannot call a click procedure of a button of another form because it is private to that form. u can do one thing. create a public procedure in your start up module. And you can call that procedure from any form.
hope this will solve your problem
regards,
prakash
-
Feb 1st, 2002, 09:14 AM
#3
You don't necessairly have to put a sub in a module. You can make a Public sub on a form. If the sub on the form is Public, it can be called from another form.
-
Feb 4th, 2002, 09:20 AM
#4
Fanatic Member
can we declare a public sub in the form? i am not sure!!
-
Feb 4th, 2002, 09:42 AM
#5
Fanatic Member
Create Public Sub in the form with the click event...
Public Sub RunClick()
CommandButton1_Click
End Sub
The call this from wherever it is needed..
MyForm.RunClick
Leather Face is comin...
MCSD
-
Feb 4th, 2002, 09:43 AM
#6
Fanatic Member
An easier alternative is to simply use the following..
MyForm.CommandButton1.Value = True
This will run the click event of commandbutton1 and does not require any extra subs...
Leather Face is comin...
MCSD
-
Feb 4th, 2002, 10:05 AM
#7
Calling click events from buttons of any sort on a different form poses a problem in that all click events are Private to the form. It is better to create a Public sub on the form. That can be accessed easily.
-
Feb 4th, 2002, 10:23 AM
#8
Fanatic Member
Yes, but all controls on a form are available...
So are there properties...
Setting the value property of a command button to true fires its click event...
Leather Face is comin...
MCSD
-
Feb 5th, 2002, 07:27 AM
#9
Originally posted by Leather
Setting the value property of a command button to true fires its click event...
You are correct providing the button resides on the same form that is doing the calling.
-
Feb 5th, 2002, 07:46 AM
#10
Originally posted by Hack
You are correct providing the button resides on the same form that is doing the calling.
NO NO NO not true. Try this
form1
VB Code:
Option Explicit
Private Sub Command1_Click()
Form2.cmdTest.Value = True
End Sub
Form2
VB Code:
Option Explicit
Private Sub cmdTest_Click()
MsgBox "Form2"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|