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

RE ::::::::::::::::User Events

Can we u define the user events in C# ?

If so can u snd me few code snippets?

My requirement is i want to fire a event when an item in
the datagrid is changed checking its validations and the
same event must fire when i click the tab key in the
datagrid ? How can i make that ?

Also other event when i change from one row to the other(
like a rowchanged event that too with a datagrid)

Please send me some code snippets?
Jul 21 '05 #1
1 1194
Yes, ofcourse you can!

public delegate void EventHandler(object sender, EventArgs e);
public class Button: Control
{
public event EventHandler Click;
}
public class LoginDialog: Form
{
Button OkButton;
Button CancelButton;
public LoginDialog() {
OkButton = new Button(...);
OkButton.Click += new EventHandler(OkButtonClick);
CancelButton = new Button(...);
CancelButton.Click += new EventHandler(CancelButtonClick);
}
void OkButtonClick(object sender, EventArgs e) {
// Handle OkButton.Click event
}
void CancelButtonClick(object sender, EventArgs e) {
// Handle CancelButton.Click event
}
}

Source (you can find a lot more info here):
http://msdn.microsoft.com/library/de...us/csspec/html
/vclrfcsharpspec_10_7.asp
--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Sneha" <an*******@discussions.microsoft.com> wrote in message
news:fc****************************@phx.gbl...
Can we u define the user events in C# ?

If so can u snd me few code snippets?

My requirement is i want to fire a event when an item in
the datagrid is changed checking its validations and the
same event must fire when i click the tab key in the
datagrid ? How can i make that ?

Also other event when i change from one row to the other(
like a rowchanged event that too with a datagrid)

Please send me some code snippets?

Jul 21 '05 #2

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

Similar topics

1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
5
by: Bruno Mendonça | last post by:
My boss asked me to build a program to create a report with logon/logoff events for all users within our windows domain. I'm using .Net to do so and decided to have a program running on the Domain...
1
by: Tebogo Tefo via .NET 247 | last post by:
Hi I have a user control that contains three dropdownlists that I populate according to what was selected in the other dropdownlist (i.e. populate dropdownlist2 after selecting a value in...
4
by: thomson | last post by:
Hi all, i do have a user control with 4 buttons, and all the events are firing properly, My problem is that i need to right an event handler in the user control, which gets fired after a...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
6
by: Art | last post by:
Hi I'm new at this and need some help. I have a "solution" with 2 projects - the main project and a library. The library is simple, it contains a text box that will appear many times in the form...
1
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP...
8
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
5
by: Richard Maher | last post by:
Hi, Here I mean "User" in the Programmer or Javascript sense. I merely wish to programmatically trigger an Event. It would be absolutely fantastic if there was a (Form level?) ONUSEREVENT() and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.