如何使用button_event将数据添加到datagridview中 [英] How can add data into datagridview using button_event

查看:52
本文介绍了如何使用button_event将数据添加到datagridview中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我有两个组合框,两个文本框和一个按钮。在按钮单击事件中我想在组合框中添加所有日期,文本框需要在datagridview中添加。

我通过创建数据表并将数据添加到datatable并最终将此数据表绑定到datagridview来添加它。但它只在第一行添加数据。在每个buttonclick事件中,它只是在datagridview的第一行添加数据,因为newely创建的datable对象引用绑定到datagridview。但我想将数据添加到datagridview作为每个按钮单击事件的新行。请给我这个问题的样本吗?

感谢您提前

Hi friends,
I have two combobox and two textbox and one button. in button click event I want to add all the date in the combobox and textbox need to add in the datagridview.
I add this by creating datatable and add data to datatable and finally bind this datatable to datagridview. but It only add data in the first row. at every buttonclick event it just add data in the first row of the datagridview,because datable object reference newely created is bind to datagridview. but i want to add data to datagridview as a new row for every button click event. please give me sample available for this issue?
Thanks for advance

推荐答案

链接供您参考:





将文本框中的数据插入gridview [ ^ ]



按钮点击向gridview添加新行

[ ^ ]
links for you reference:


inserting data from textboxes into gridview[^]

add a new row to gridview on button click
[^]


这篇关于如何使用button_event将数据添加到datagridview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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