VB.NET DataGridView 如何设置默认值

2025-04-11 06:37:57

VB.NET DataGridView 中,增加的新行设置默认值。

工具/原料

VB.NET

代码

1、datagrid响应的事件是: DefaultValuesNeeded

VB.NET DataGridView 如何设置默认值

2、列的获取:e.Row.Cells("列名").Value

3、代码示例: Private Sub DataGridholiday_De酆璁冻嘌faultValuesNeeded(B烤恤鹇灭yVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles DataGridholiday.DefaultValuesNeeded e.Row.Cells("column1").Value ="1" e.Row.Cells("column2").Value = "2" e.Row.Cells("column3").Value = "3" End Sub

4、效果如图

VB.NET DataGridView 如何设置默认值
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢