Questions tagged [eventargs]

Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.

Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.

This class serves as the base class for all classes that represent event data. For example, the System.AssemblyLoadEventArgs class derives from EventArgs and is used to hold the data for assembly load events. To create a custom event data class, create a class that derives from the EventArgs class and provide the properties to store the necessary data. The name of your custom event data class should end with EventArgs.

http://msdn.microsoft.com/en-us/library/system.eventargs(v=vs.110).aspx

164 questions
3
votes
1 answer

event args assigning

i have this event handler Temp.MouseLeftButtonDown += new MouseButtonEventHandler(Temp_MouseLeftButtonDown); but i wanna send some parameter to access in the Temp_MouseLeftButtonDown function. how can i assign it ??
Miroo
  • 795
  • 3
  • 13
  • 35
3
votes
2 answers

Subscribe to button click of another form

So I have 2 forms and need to pass a property from one form to the other. On Form 1 I have a method private void rb_CheckedChanged(object sender, EventArgs e) { var frm2= new Form2(); WorkComplete += frmSetNewTime.btnOk_Click; …
DidIReallyWriteThat
  • 1,033
  • 1
  • 10
  • 39
3
votes
5 answers

break button_click event when enter pressed

Is an easy way to cancel click event when user hit enter on button (instead of mouse click on button?) i have tried with: private void button3_Click(object sender, EventArgs e) { KeyEventArgs ke = e as KeyEventArgs; if (ke !=…
iskrzycki
  • 154
  • 2
  • 13
3
votes
3 answers

How do EventArgs Cancel work in the FormClosing Event?

How does the e.Cancel event work in the FormClosing event on a WinForm? I know you set it to True to cancel the closing, but at what point does the form process this? Is there a secondary action taken by the property? How could I implement a…
Stevoni
  • 341
  • 7
  • 18
3
votes
1 answer

EventArgs.Empty clarification?

I have a method protected void Item_Click(object sender, EventArgs e) { } I wanted that other code to call this method. ( didn't really need the sender nor e) something like : Item_Click(null, null) But then I remembered I can use…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
2
votes
1 answer

vb.net console app using sender As Object and e As EventArgs

I have the following code that allows my console app to go to the tray with an icon: Sub Main() Dim tray As New NotifyIcon() tray.Icon = My.Resources.phoneIcon tray.Text = "Left Click to show console window" tray.Visible = True …
StealthRT
  • 10,108
  • 40
  • 183
  • 342
2
votes
2 answers

C# - Override eventargs of WebBrowserDocumentCompletedEventHandler

I would like to override the EventArgs of the event WebBrowserDocumentCompleted. I can't create a personal event handler, because I have no idea when I should fire the event DocumentDownloadCompleted. The data I would like to add to the EventArgs is…
user967598
  • 55
  • 2
  • 8
2
votes
6 answers

C# Custom EventArgs Question

I have a custom collection that I am adding a ValidateItem event to. This ValidateItem event will be called whenever an item is added to or updated in the custom collection. I want to allow derived classes to be able to subscribe to the event and…
Max Schilling
  • 2,891
  • 4
  • 25
  • 28
2
votes
2 answers

Pass additional parameters or objects using an Event Handler

I feel like this is really basic, but I'm having trouble with this issue. I'm using a Process object and subscribing to a DataReceivedEventHandler. This event handler then delegates to another method, in this case "DoSomething", and the signature…
5StringRyan
  • 3,604
  • 5
  • 46
  • 69
2
votes
0 answers

C# Serialize EventArgs to Xml

I am trying to serialize an object that contains an EventArgs object. If I ignore the EventArgs object upon serialization, everything works fine, but if I don't put an [XmlIgnore] above it, the application crashes with the error…
ashurexm
  • 6,209
  • 3
  • 45
  • 69
2
votes
1 answer

Referencing multiple instantiated pictureboxes

I'm very new to C# but trying to learn so bear with me if my syntax isn't accurate. I am able to create a picturebox with a button and it appears on screen. I can then move it around the screen just fine with a mouse down / mouse move function. I…
Rob
  • 25
  • 7
2
votes
1 answer

Event Design Guidelines

I try to stick as much as possible to the Framework Design Guidelines even when designing class libraries intended only for internal use. To a certain degree, it makes my life easier as I use Code Analysis to automate checking for places I may not…
Alfred Myers
  • 6,384
  • 1
  • 40
  • 68
2
votes
0 answers

Get right clicked item from context menu inside wrappanel inside itemscontrol

I have an ItemsControl which has a WrapPanel inside of it. Inside that WrapPanel I have a context menu. The whole thing looks like this:
Tim Kathete Stadler
  • 1,067
  • 4
  • 26
  • 52
2
votes
1 answer

Difference between event Action and event EventHandler

What is the problem when declaring events with Action public interface ISomething { event Action MyEventName; } or public interface ISomething { event Action MyBoolEventName; } instead of the other variant of the previous code…
Beachwalker
  • 7,685
  • 6
  • 52
  • 94
2
votes
2 answers

Is += delegate {} the correct way to attach custom eventargs to a UI control event?

I have been tinkering with Events to gain a better understanding of their use in very general situations. I'm surprised to find the following, so I'm probably heading in the wrong direction...the essence of what I'm doing is changing a button to a…
Stephan Luis
  • 911
  • 1
  • 9
  • 24
1 2
3
10 11