473,480 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Button3.PerformClick()

Hello,
I am trying to program a button to click with code. I
do not want to have to repeat the code that I already have
in the project. I figured that I could use the button
that is alreay there instead of redoing it. The only
thing is that I can't seem to get the button to fire
without the user clicking it. It says proform click is
not a member of sysyem.web.ui.webcontrols.button. Is
there a way to make this happen on a webform

example code:
Private Sub Button4_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button4.Click
txtReqAsset.Text = txtLinked1.Text
Button3.PerformClick()
End Sub
Nov 20 '05 #1
5 8346
Cor
Hi Brian,

When I understand you right, I am not sure of that, than do
you want in the serverside event of the button 4 also perform button 3.

There are 2 simple approaches for that:

Private Sub Button4_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button4.Click

DoTheThingsForButton3(sender,e)

End sub

Private Sub Button3_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button4.Click

DoTheThingsForButton3(sender,3)

End sub

Private DoTheThingsForButton3()
Do what you want.
End sub

A simple approach when you do not need the sender and the e(event) you can
do in the Button4 event

Button3_Click(nothing,nothing)

I hope this was what you did mean and that it did help?

Cor

Nov 20 '05 #2
Hello Brian,

Like all things. The button must have an event handler. When you create an
event your create a function ( perform_click ) and add a hanler which binds
the event to the function. This is where you are going wrong. You cant
simply add a button and expect something to happen unless you make it so.

If I understand you correctly, you want the button to invoke code used by
another one right ?. If this is the case add an event handler for the new
button and point it to the function

OHM
Brian wrote:
Hello,
I am trying to program a button to click with code. I
do not want to have to repeat the code that I already have
in the project. I figured that I could use the button
that is alreay there instead of redoing it. The only
thing is that I can't seem to get the button to fire
without the user clicking it. It says proform click is
not a member of sysyem.web.ui.webcontrols.button. Is
there a way to make this happen on a webform

example code:
Private Sub Button4_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button4.Click
txtReqAsset.Text = txtLinked1.Text
Button3.PerformClick()
End Sub

Nov 20 '05 #3
* "Brian" <ja*****@amc.com> scripsit:
I am trying to program a button to click with code. I
do not want to have to repeat the code that I already have
in the project. I figured that I could use the button
that is alreay there instead of redoing it. The only
thing is that I can't seem to get the button to fire
without the user clicking it. It says proform click is
not a member of sysyem.web.ui.webcontrols.button. Is
there a way to make this happen on a webform


'PerformClick' is supported by the Windows Forms button control. You
may want to remove the code from the handler, add it to a separate
procedure and call this procedure from the 'Click' event handler. This
procedure can be called from other code too.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #4
Cor
Herfried,
It says proform click is
not a member of sysyem.web.ui.webcontrols.button. Is
there a way to make this happen on a webform


'PerformClick' is supported by the Windows Forms button control. You
may want to remove the code from the handler, add it to a separate
procedure and call this procedure from the 'Click' event handler. This
procedure can be called from other code too.


Don't make an excuus, I think Brian sees that himself also.

:-)

Cor
Nov 20 '05 #5
That worked perfect. Thanks for the help.
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1540
by: aToaster | last post by:
Hey guys, I'm just getting the hang of Python and Tkinter and I could use some help. I wrote most of the gui for my calculator program, well I haven't gotten around to putting in the...
4
2582
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
1
5126
by: Marcin Zmyslowski | last post by:
Hello everybody! I have the problem with using Button1.PerformClick() method. I don`t know how to call the button. I have been searching the newsgroups but I didn`t find any exact description...
6
2106
by: Radith Silva | last post by:
Private Sub cmdCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCalculate.Click If txtName.Text <> "" Then If txtUnits.Text <> "" Then If optOne.Checked Or...
2
1351
by: S Shulman | last post by:
Hi I am using the following method "MenuItem.PerformClick" in order to open a menu but it doesn't work Any suggetions? Shmuel Shulman SBS Technologies LTD
4
1759
by: Stanav | last post by:
Hello all, When a user click on the "Update" button on my program, I want to update the database using the sub below. I was able to insert and modify records, but can't delete records. The error...
5
7184
by: stevenhaochen | last post by:
Form.Visible=False Button1.PerformClick It does not fire the Button1.Click event. Why?
0
1048
by: Michel Vanderbeke | last post by:
Hello everyone, In my application I have two forms: form_1 and form_2 On form_1 two buttons: button_1 and button_2 The code on button1_click form_2.ShowDialog() form_2.Dispose()
0
1219
by: Claire | last post by:
My richedit control uses the validating event to prevent loss of focus from itself when buttons are clicked but should call the sender button's PerformClick method to call the buttons default...
0
7044
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7087
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.