473,471 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1196
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: 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
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...
1
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...
1
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...
0
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 ...
0
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.