DataGridView.Rows.Add()出错 [英] Error with DataGridView.Rows.Add()

查看:76
本文介绍了DataGridView.Rows.Add()出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用visual c#2008

我设置了一个包含设计师2列的datagridview。

当我运行程序DataGridView.Rows.Add()弹出一个错误说(翻译)

在添加行之前,你必须在行中添加colums

我在手动填充datagridview之前做过一些项目,从来没有想过这个

错误。

有什么想法吗?


i'm using visual c# 2008
i've set up a datagridview containing 2 columns with the designer.
when i run the program DataGridView.Rows.Add() pops up an error saying (translated)
"before adding a row you have to add colums to the row"
I've done some projects before populating datagridview manually and never came up with this
error.
Any ideas ?

推荐答案

异常意味着它所说的内容。您正在尝试将行添加到没有列的表。看看这里看一个例子你需要的东西。
The exception means exactly what it says. You are attempting to add rows to a table that has no columns. Have a look here to see an example what you will need.


在你添加行之前通过调试进行检查,如果列存在于datagridview中。
check by debugging before you add the row that if the columns exists in datagridview.


这篇关于DataGridView.Rows.Add()出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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