使用vb.net专注于datadridview中的上一个单元格(Windows应用程序) [英] focus on previous cell in datadridview using vb.net(Windows Application)

查看:112
本文介绍了使用vb.net专注于datadridview中的上一个单元格(Windows应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

am在datagridview中具有三个单元格,即cell-1,cell-2,cell-3.在这里,我想关注于cell-1,而在上面输入了错误的数据,而是将重点放在了下一个单元格上...

在我的编码中,我在输入null值的同时设置了msgbox警报...我的问题是如何在该单元格中输入错误数据期间专注于当前单元格而不是移至下一个单元格

在此先感谢

am having three cells i.e,cell-1,cell-2,cell-3 in datagridview..here i wanna to focus on cell-1 while wrong data entered on it instead focus move on next cell...

In my coding i set msgbox alert while null values are enter...My question is How to focus on current cell instead of moving to next cell during wrong data entries in that cell

thanks in advance

推荐答案



使用DataGridView的CellValidating事件来验证单元格值.

步骤:
-使用DataGridView的CellValidating事件,
-获取为其调用事件的单元格,
-如果单元格处于EditMode,则
-进行验证.

http://msdn.microsoft.com/en-us/library/ykdxa0bc.aspx [ ^ ]

希望对您有帮助... :)

茉莉(Jasmin)
Hi,

Use CellValidating event of DataGridView to validate cell values.

Steps:
- Use DataGridView''s CellValidating event,
- Get the cell for which the event is called,
- If the cell is in EditMode then,
- Perform validation.

http://msdn.microsoft.com/en-us/library/ykdxa0bc.aspx[^]

Hope that helps... :)

Jasmin


这篇关于使用vb.net专注于datadridview中的上一个单元格(Windows应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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