在gridview中有问题 [英] have a problem in gridview

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

问题描述

Hai,

实际上我想将一个网格列减去另一个网格列但我有这样的问题



参数'表达式'无法转换为'DBNull'类型



'我的代码







DataGridView1.Rows.Item(i).Cells(3).Value = Val(DataGridView1.Rows.Item(i).Cells( 4).Value) - Val(DataGridView1.Rows.Item(i).Cells(5).Value)

Hai,
Actually i want to subtract one grid column to another grid column but i have a problem like this

"Argument 'Expression' cannot be converted to type 'DBNull' "

it' my code



DataGridView1.Rows.Item(i).Cells(3).Value = Val(DataGridView1.Rows.Item(i).Cells(4).Value) - Val(DataGridView1.Rows.Item(i).Cells(5).Value)

推荐答案

尝试在调试时遵循您的代码,

i猜你试图减去一个或两个空单元格。

(例如5 - 没有 =错误)



您可以检查空单元格并将其替换为0.



希望这可以解决您的问题

Bert
Try to follow your code while you debug,
i guess you try to substract one or two empty cells.
(ex. 5 - nothing = ERROR)

You could check for empty cells and replace them with a 0.

Hope this solves your problem
Bert


这篇关于在gridview中有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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