Visual Studio 2012行为 [英] Visual studio 2012 behaviour

查看:99
本文介绍了Visual Studio 2012行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从一本名为《 C#数据库基础知识》的书中学习C#,其中一部分练习是以下代码行:
orders_details_bndSource.CurrentItemChanged + =新的EventHandler(orders_details_bndSource_CurrentItemChanged);

当我在编辑器中键入它时,出现以下构建错误:
名称"orders_details_bndSource_CurrentItemChanged"在当前上下文中不存在
C:\ Users \ steve \ documents \ Visual Studio 2012 \ Projects \ SimpleDataEntryForm \ SimpleDataEntryForm \ Form1.cs 55 74 SimpleDataEntryForm
我究竟做错了什么?我已经从书中逐行跟踪了代码.

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.

推荐答案

这是在告诉您,没有名为"orders_details_bndSource_CurrentItemChanged"的方法.在C#中,有一个生成它的快捷方式.键入orders_details_bndSource.CurrentItemChanged + =,然后按两次TAB键.它将为您生成存根.

但是我敢打赌,如果您看上去够用心的话,它就会出现在书中.
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.


这篇关于Visual Studio 2012行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆