Public Event Undefined Value

A

Antonio

Hi, I have a simple user control with a public event that's raised by a
datagrid selectindexchanged event.

public event EventHandler UserAccountChosen;

private void dgUserSearch_SelectedIndexChanged(object sender,
System.EventArgs e)
{
if(UserAccountChosen != null) // here!!
{
this.UserAccountChosen(this, e);
}
}

but at runtime in debug where I wrote // here!! when I hover over
UserAccountChosen is says

UserAccountChosen = <undefined value>

and I dont understand why. Anyknow know what does that? What am i
missing
 
G

Guest

Hi Antonio.
What are you really going to do? Create an event?
try something like this:


void Page_OnLoad(...)
{
DataGrid.OnSelectedIndexChanged += new EventHandler(myEvent);
}

void myEvent((object sender, EventArgs e)
{
// your code goes here
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top