DataGridView组件自动递增代码

VB.NET · 2023-11-01 · 236 人浏览

取自程序的一段代码,放到博客,省得下次再找了。

Dim rowIndex As Integer = DataGridView1.Rows.Add()
    With DataGridView1.Rows(rowIndex)
        .Cells(0).Value = rowIndex + 1 
        .Cells(1).Value = nickname 
        .Cells(2).Value = unique_id 
        .Cells(3).Value = following_count 
        .Cells(6).Value = 待监控的粉丝数量 
        .Cells(8).Value = "基础数据已获取"
        .Cells(9).Value = id_str 'sec_uid
    End With
    DataGridView1.Refresh()