473,387 Members | 1,791 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,387 software developers and data experts.

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 1346
hi,
based on this sample, events are fired according
to the sequence of subscription.

using System;
using System.ComponentModel;
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(btnClick1);
btn.Click += new EventHandler(btnClick3);

btn.Click += new EventHandler(btnClick2);
btn.Text = "Click";
this.Controls.Add(btn);
}

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

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

private void btnClick3(object 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
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...
1
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...
20
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...
1
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....
1
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.