Click here to Skip to main content
15,878,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to learn C# from a book called C# Database basics and part of one of the exercises is this line of code:
orders_details_bndSource.CurrentItemChanged += new EventHandler(orders_details_bndSource_CurrentItemChanged);

When I type it into the editor, I get the following build error:
The name 'orders_details_bndSource_CurrentItemChanged' does not exist in the current context
C:\Users\steve\documents\visual studio 2012\Projects\SimpleDataEntryForm\SimpleDataEntryForm\Form1.cs 55 74 SimpleDataEntryForm
What am I doing wrong? I have follwed the code line by line from the book.

1 solution

It is telling you that there is no method named "orders_details_bndSource_CurrentItemChanged". In C# there is a shortcut to generate it. Type orders_details_bndSource.CurrentItemChanged += and then press TAB twice. It will generate the stub for you.

But I bet if you look hard enough it is in your book.
Share this answer
bbirajdar 19-Jul-12 8:02am    
Yes..This is the correct answer .. +5

And good luck to OP for his studies.But you should be more keen in reading. The steps for generating the event handler must be mentioned in the book. Don't just copy paste the code & execute it...Try to understand it...
SteveHOwen 19-Jul-12 8:54am    
Thanks, Ryan. It didn't say that in the book, but your way worked! Thanks again.
ZurdoDev 19-Jul-12 9:13am    
Glad to hear it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900