更新:2007 年 11 月
DataGridView 控件提供几个功能,使您可以更改用户在控件中添加或修改数据的方式。例如,通过为新行提供默认值以及在出错时通知用户,可以提高数据输入的效率。
本节内容
- 如何:指定 Windows 窗体 DataGridView 控件的编辑模式 
 描述如何更改用户开始编辑单元格的方式。
- 如何:为 Windows 窗体 DataGridView 控件中的新行指定默认值 
 描述如何预填充新记录行以节省数据输入时间。
- 在 Windows 窗体 DataGridView 控件中使用新记录行 
 详细描述新记录行,包括如何将它隐藏,如何自定义它的外观以及它与 Rows 集合的关系。
- 演练:验证 Windows 窗体 DataGridView 控件中的数据 
 描述如何验证用户输入以防止输入数据时出现格式错误。
- 演练:处理在 Windows 窗体 DataGridView 控件中输入数据时发生的错误 
 描述如何处理当用户试图提交新值时从数据源产生的数据输入错误。
参考
- DataGridView 
 提供 DataGridView 控件的参考文档。
- DataGridView.EditMode 
 提供 EditMode 属性的参考文档。
- DataGridView.DefaultValuesNeeded 
 提供 DefaultValuesNeeded 事件的参考文档。
- DataGridView.DataError 
 提供 DataError 事件的参考文档。
- DataGridView.CellValidating 
 提供 CellValidating 事件的参考文档。
相关章节
- 在 Windows 窗体 DataGridView 控件中显示数据
 提供描述如何使用数据手动填充控件或通过外部数据源填充控件的主题。
请参见
概念
Windows 窗体 DataGridView 控件中的列类型