请问如何把datagrid控件中一行中的数据显示在几个edit控件中?谢谢

解决方案 »

  1.   

    With datagrid
         If .Col = -1 Then
            Text1.Text = .Columns(1).Value
            text2.text=.Columns(2).Value
            .
            .
            .
         Else
            Text1.Text = ""
            text2.text=""
            .
            .
            .
         End If
    End With
      

  2.   

    同意syszj() 的做法,但虽然方法是简单,但我认为不实用,在给你一点建议
    Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    With datagrid
         .Col = 0
         Text1.Text = .Text
         .Col = 1
         Text2.text = .Text
         .Col = 2
         Text3.text = .Text
         ...
         ...  
    End With
    End Sub这样的话在你想要的数据行里面随便点就可以了,前提是把行锁定,在属性里面有,自己看看就知道了bluesanke() 的说从5条里面选3条,也好办,只要是创建一个数组就可以解决,如果你能说明白点,解决只是时间问题~