VB中读取DataGrid控件指定单元格的数据
注意 是datagrid控件 而不是别的类似的数据网格
追问:可是错误提示为 无效的属性值啊 ,怎么办
Dim str As String
str = DataGrid2.Row(1).Items(1).tosrting
MsgBox str有啊 有很多 列有十多个 行有几百个
注意 是datagrid控件 而不是别的类似的数据网格
追问:可是错误提示为 无效的属性值啊 ,怎么办
Dim str As String
str = DataGrid2.Row(1).Items(1).tosrting
MsgBox str有啊 有很多 列有十多个 行有几百个
答案:你要注明你的VB版本,VB6跟后面版本(.net)是不一样的。
你的指定单元格是怎么指定的?行列号?对于绑定操作的DATAGRID,行号在大多数情况下是没有意义的,通常通过查找记录的方式将游标定位到你要的记录上,然后读取指定列的文本:
str = DataGrid1.Columns(2).Text
如果是用户选择那条记录,那么可以用当前行的文本:
str = DataGrid1.Text
其他:dim Str as string
str=datagrid.row(行数).items(列数).tosrting
str里的内容就是DataGrid指定单元格的数据了。
上一个:VB里Text2 = "": Text3 = "": Text4 = "": Text5 = "": Text6 = "" 相同值怎么简单地定义
下一个:急求用vb编写8*8对角矩阵代码