网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

VB.NET DataGridView 如何设置默认值

时间:2026-02-14 06:23:24

1、datagrid响应的事件是:

    DefaultValuesNeeded

VB.NET DataGridView 如何设置默认值

2、列的获取:

       e.Row.Cells("列名").Value

3、代码示例:

    Private Sub DataGridholiday_DefaultValuesNeeded(ByVal 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 如何设置默认值

© 2026 智德知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com