我发现在使用data grid控件显示数据,当我用鼠标在每一条记录上点击时出现数据改动的情况
如:
   我现在的data grid有3条记录4列,我点击第一条记录的第一列,第一次点击是全部选中(就是将   第一条记录的第一列字段的值全选上,在点一次的时候最后一个字段(第一条记录的第四列)的值  就改变了,变成和第一条记录的第一列字段的值一样了,这个问题怎么解决,谢谢

解决方案 »

  1.   

    不准确:
    如果你想操作某些字段,你可以采用:
    Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
        '读取、写入数值
    End Sub出现你说的情况可能是你做了其他的操作(语句),你可以贴出来看看吗?
      

  2.   


    Private Sub DataGrid1_Click()
    '显示响应的信息
    Dim Student_Name As String '学生姓名
    Dim Student_Sex As String '学生性别
    Dim Student_Id As String '学生学籍号
    Dim Student_Exprice As String '学生卡有效期
    Dim Picfilename As String 'Student.jpg
    Dim Fontforcolor As Integer
    Dim Fontforsize As Integer
    On Error Resume Next
    With DataGrid1
       .DefColWidth = 188.0095
       .AllowUpdate = False
       .AllowArrows = True
       .Col = 0
          Student_Id = .Text '学生学籍号
       .Col = 1 '列号
          Student_Name = .Text '学生姓名
       .Col = 2
          Student_Sex = .Text '学生性别
       .Col = 3
          Student_Exprice = .Text '学生卡有效期
    End With
    end sub我的代码是这样的 呀