仅在buttonclick上将数据添加到datagrid [英] adding data to datagrid only on buttonclick

查看:54
本文介绍了仅在buttonclick上将数据添加到datagrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用datagridview,在窗体加载时它已经包含1行,因此用户可以直接添加数据,但是我想将初始行设置为0,并且用户应该只能在单击按钮时添加数据.我已经编写了代码,可以在单击按钮时添加数据,但是不能停止直接输入数据.如何做到这一点?(这只是一个简单的appln,不涉及数据绑定)
Windows应用程序,c#.


在此先感谢,

i am presently working with datagridview,on form load it already contains 1 row so the user can directly add data,but i want to set the initial rows to 0, and user should be able to add data only on button click. i have written code to add data upon button click but cant stop entering data directly. how to do this??(this is just a simple appln no databinding involved)
windows application,c#.


thanks in advance,

推荐答案

dataGridView1.AllowUserToAddRows = false;
可能会解决您的问题
dataGridView1.AllowUserToAddRows = false;
might solve your problem


这篇关于仅在buttonclick上将数据添加到datagrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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