473,395 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Button1_Click not used

I had a project where I had some code in my Button1_Click procedure and
copied it over to a new project (that had the same button name on it) and I
couldn't figure out why the event never fired.

I then double-clicked on the button and a new event opened which normally
would have been Button1_Click, but in this case it was Button1_Click_1. I
assume this was because I had manually put in the Button1_Click event.

Why did it do that?

Does that mean I can't manually put in my code without first using the
Design Screen first, Double clicking the object I want to add code to and
then add it to the procedure IT puts in?

Thanks,

Tom
Nov 17 '05 #1
1 1397
"tshad" <ts**********@ftsolutions.com> wrote in message
news:uY**************@TK2MSFTNGP09.phx.gbl...
I had a project where I had some code in my Button1_Click procedure and
copied it over to a new project (that had the same button name on it) and I
couldn't figure out why the event never fired.
If you just copy over the method, that doesn't add the required EventHandler
for the button1->Click event. There's nothing magic about the Button1_Click
name (even though it looks it).
I then double-clicked on the button and a new event opened which normally
would have been Button1_Click, but in this case it was Button1_Click_1. I
assume this was because I had manually put in the Button1_Click event.

Why did it do that?
Since a Button1_Click method already exists, VS assumes that it can't use
that name when it generates code.
Does that mean I can't manually put in my code without first using the
Design Screen first, Double clicking the object I want to add code to and
then add it to the procedure IT puts in?


Not at all. In this case, you could go to the designer, select the button,
click on the Event button in the Properties Window, and enter the method
name in the Click entry. This will generate an EventHandler for the button's
Click event using whatever method you put in.
Nov 17 '05 #2

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

Similar topics

4
by: J. Campbell | last post by:
From reading this forum, it is my understanding that C++ doesn't require the compiler to keep code that does not manifest itself in any way to the user. For example, in the following: { for(int...
3
by: fabio de francesco | last post by:
Hello, I have a couple of years of experience with C++. I started studying C++ syntax, then I read the B.Stroustrup's book, and eventually I went through the N.Josuttis' book on how to program...
3
by: NickName | last post by:
Here's the situation, developers inherit a web app from someone, backend SQL db has about 120 user tables and the db is also being used by other apps. Developers don't have a list of user tables...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
23
by: rohit | last post by:
Hi, In my couple of years of experience, I have never found a single instance where I needed to use unions and bitfields(though I have used structures).I was just imagining where would these find...
1
by: Chua Wen Ching | last post by:
Hi there. this is my codes in vb6: private Action as integer private sub button1_Click(index as integer) Action = Index End Sub private sub picture1_mousedown(button as integer, shift as...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
3
by: NeverwaY | last post by:
How can i make a button click change an image in a picture box? I basically have an image in my main Form, i want it to change when a button is clicked. -- <XML> <BEGIN:: DCSE-TRAINING> <END::...
4
by: Bali | last post by:
Hi I have an ascx control through which I am calling an aspx page using the following command. Page.ClientScript.RegisterStartupScript(GetType(), "test", "window.open(...)"); Initially I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
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
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...

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.