473,804 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

about events

i registered two events with a button.
when i press it , how can i know which is fired first?
or is there a way to make one of them get fired before the other one?

in fact i made a experiment about it :

i put message boxes in the events, when i press button only one event is
fired and other is never. why does that happens?
Nov 16 '05 #1
1 1362
hi,
based on this sample, events are fired according
to the sequence of subscription.

using System;
using System.Componen tModel;
using System.Drawing;
using System.Windows. Forms;

public class WindowsForm : System.Windows. Forms.Form
{
private Button btn = new Button();

public static void Main()
{
Application.Run (new WindowsForm());
}

public WindowsForm()
{
btn.Click += new EventHandler(bt nClick1);
btn.Click += new EventHandler(bt nClick3);

btn.Click += new EventHandler(bt nClick2);
btn.Text = "Click";
this.Controls.A dd(btn);
}

private void btnClick1(objec t sender, EventArgs e)
{
MessageBox.Show ("1");
}

private void btnClick2(objec t sender, EventArgs e)
{
MessageBox.Show ("2");
}

private void btnClick3(objec t sender, EventArgs e)
{
MessageBox.Show ("3");
}

}
HTH,

--
gani
http://thedeveloperscorner.com.ph
-----Original Message-----
i registered two events with a button.
when i press it , how can i know which is fired first?
or is there a way to make one of them get fired before the other one?
in fact i made a experiment about it :

i put message boxes in the events, when i press button only one event isfired and other is never. why does that happens?
.

Nov 16 '05 #2

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

Similar topics

220
19198
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
1
3048
by: Steve | last post by:
I've run in to a problem with a query I'm trying to write. I have attached a sample SQL script at the end of this post to show an overview of what I'm working with. I want to be able to use LIMIT to control how many rows from one table are returned, independent of how many rows there are in a second table that is joined to the first. When I execute the following SQL script:
20
3353
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to speed. I like books with practical exercises, and also with test questions (like cert books) *2*
1
1159
by: Christoph Boget | last post by:
Where can I find *comprehensive* information about events? I've been all through Microsofts developer pages, through the VS.NET help but I can't find comprehensive, details information about them. For example, I'm working with a TreeView control. I've set up 2 even handler methods, one for "AfterSelect" and one for "Click". In the "AfterSelect" handler method, I can access the TreeView object to get state information and work with member...
1
1136
by: Tom Rahav | last post by:
Hi, I use VB .NET 2003 and I want to create a new UserControl that will function as a "smart" combobox that handles few events automatically (such as auto-complete, etc.) in addition to the regular combobox events. I created a new class that inherits from: System.Windows.Forms.ComboBox. I added the some code to the events in the new combobox (in the UserControl project) and add the control to a win-form in a different project. The...
0
9714
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6866
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.