datagrid 中表格单元位置的表示方法

azhe127 2004-01-08 08:38:50
请问:
要在表格中用一个单元格来表示另两个或多个单元格之和,应该怎么写语句?


赐教!
...全文
66 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2004-01-08
  • 打赏
  • 举报
回复
Private Sub Command1_Click() 'suppose your datagrid have two columns,and the first column is numbers .
Dim sum As Long
sum = 0
For i = 0 To 4
DataGrid1.Row = i
DataGrid1.Col = 0
sum = sum + CLng(DataGrid1.Text) 'get sum of col(1)
Next
DataGrid1.Row = 0
DataGrid1.Col = 1
DataGrid1.Text = "the sum of col 1 is " & sum 'send text to (0,1)
End Sub

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧