TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
brian ashcroft
NA
5
0
Error with "this"
Sep 3 2007 10:28 AM
This is probably an already answered questions, but you can imagine the trouble using google to find "c# + this". So I have a class that is trying to trigger an event.
I have the delegate definition
public delegate void OnServingSelectedEvent(object sender, decimal Serving);
class FractionDecimalTextBox:SourceGrid.Cells.Editors.TextBox
{
public event OnServingSelectedEvent OnServingSelected;
public override bool ApplyEdit()
{
OnServingSelected(this, Generals.ToDecimal(Control.Text));
return base.ApplyEdit();
}
}
I keep getting the error
Object reference not set to an instance of an object.
With
Cannot obtain value of local or argument '<this>' as it is not available at this instruction pointer, possibly because it has been optimized away. AutocompleteGrid.FoodGrid.FractionDecimalTextBox
shown in the watch page.
As far as I understand it, this is supposed to point to the current object, but I keep getting this error, although it is completely unregular as I have another class where it works great. Does anyone know what I am doing wrong?
Reply
Answers (
3
)
Send Message to all users on LAN in C# without net send
PC Inactivity