如何清除winform中的datagrid视图数据? [英] How to clear the datagrid view data in winform?

查看:79
本文介绍了如何清除winform中的datagrid视图数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,
在窗口加载中,我创建带有复选框和文本框列的数据网格视图.

Hi friends,
In window load, i create a datagrid view with checkbox and textbox column.

private System.Windows.Forms.DataGridViewTextBoxColumn colText = new DataGridViewTextBoxColumn();
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckBox = new DataGridViewCheckBoxColumn();





dataGridView1.Columns.AddRange(new DataGridViewColumn[] { colCheckBox, colText });
           colCheckBox.HeaderText = "Check";
           colText.HeaderText = "Amount";





string cnd = "select name from fees_master";
          MySqlDataAdapter da = new MySqlDataAdapter(cnd, connection);
          connection.Open();
          DataSet ds = new DataSet();
          da.Fill(ds, "course_master");
          dataGridView1.DataSource = ds.Tables["course_master"];
          connection.Close();



它的工作正常.但现在我想在datagridview文本框列中插入mysql数据,然后选中复选框.有什么办法吗?.



Its work correctly. but now i want to insert the mysql data in datagridview textbox column and check box check change. is any way is there?.

thanks in advance.

推荐答案

我想您想对textbox列文本更改或checkbox列选中的更改事件有一些逻辑.

如果是这样,则可以使用DataGrid__CellValueChanged事件.
I guess you want to have some logic on textbox column text change or checkbox column checked change event.

If it is so then you can use DataGrid__CellValueChanged event.


这篇关于如何清除winform中的datagrid视图数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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