以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教对话框的问题,为什么要红冲的时候不弹出对话框?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=71930)

--  作者:yacity
--  发布时间:2015/7/20 18:42:00
--  请教对话框的问题,为什么要红冲的时候不弹出对话框?
表的 datacolchanging 事件代码如下:

Select Case e.DataCol.Name
       
Case "hongchong"
 If e.DataRow.isnull("hongchong") = False 
 If e.DataRow("hongchong") = False
Dim Result As DialogResult
If Result = DialogResult.no Then
Result = MessageBox.Show("您确定要红冲吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
e.Cancel = True

 End If
Else

Dim Result As DialogResult
Result = MessageBox.Show("您确定要反红冲吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.no Then
    
e.Cancel = True
End If

End If
End If

End Select


实际运行结果: 单击 hongchong 列 要红冲的时候,直接红冲,没有弹出对话框。 取消红冲的时候 弹出对话框,可以正常使用。
 是什么原因照成要红冲的时候 不弹出对话框呢?
代码要怎么写?

--  作者:大红袍
--  发布时间:2015/7/20 19:13:00
--  

在datacolchanging事件,值没有生成

 

If e.DataRow.isnull("hongchong") = False 

 If e.DataRow("hongchong") = False

 

改成

 

If e.NewValue = False Then


--  作者:yacity
--  发布时间:2015/7/22 17:09:00
--  
谢谢大红袍~!!!