ds.Tables(0).Columns.Add("colunmname", GetType(String)) 'ds代表数据源
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
If CBool((ds.Tables(0).Rows(i)("colunmname"))) Then '更改那个字段的显示
ds.Tables(0).Rows(i)("colunmname") = "Y"
Else
ds.Tables(0).Rows(i)("colunmname") = "N"
End If
Next
Me.ds.AcceptChanges()
Me.gridviewname.DataSource = Me.ds.Tables(0)
'edit cell
Dim dr As Data.DataRow
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
dr = ds.Tables(0).Rows(i)
If CType(dr("colunmname"), Boolean) = True Then
Me.gridviewname.Rows(i).Cells(2).ReadOnly = False '指定单元格的只读属性
End If
Next
原文:http://blog.csdn.com/wangpeixian/article/details/3224260
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
If CBool((ds.Tables(0).Rows(i)("colunmname"))) Then '更改那个字段的显示
ds.Tables(0).Rows(i)("colunmname") = "Y"
Else
ds.Tables(0).Rows(i)("colunmname") = "N"
End If
Next
Me.ds.AcceptChanges()
Me.gridviewname.DataSource = Me.ds.Tables(0)
'edit cell
Dim dr As Data.DataRow
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
dr = ds.Tables(0).Rows(i)
If CType(dr("colunmname"), Boolean) = True Then
Me.gridviewname.Rows(i).Cells(2).ReadOnly = False '指定单元格的只读属性
End If
Next
原文:http://blog.csdn.com/wangpeixian/article/details/3224260
本文介绍了一种方法,用于在Visual Basic.NET中修改数据集中的特定列,并更新GridView控件以反映这些更改。该过程包括添加新列、转换现有列的值以及编辑单元格的只读属性。
3160

被折叠的 条评论
为什么被折叠?



