我想单击选中DataGrid的其中一行的信息显示在text1中,怎么做?
PrivateSubDataGrid1_Click()DimstrAsStringcnn.CursorLocation=adUseClientSetrst=NewADOD...
Private Sub DataGrid1_Click()
Dim str As String
cnn.CursorLocation = adUseClient
Set rst = New ADODB.Recordset
str = "select * from 表"
rst.Open str, cnn, adOpenStatic, adLockPessimistic
rst.Requery
Set DataGrid1.DataSource = rst.DataSource
Text1.Text = DataGrid1.Columns(1)
Set rst = Nothing
End Sub
每一次都显示第一行的值,郁闷!!!! 展开
Dim str As String
cnn.CursorLocation = adUseClient
Set rst = New ADODB.Recordset
str = "select * from 表"
rst.Open str, cnn, adOpenStatic, adLockPessimistic
rst.Requery
Set DataGrid1.DataSource = rst.DataSource
Text1.Text = DataGrid1.Columns(1)
Set rst = Nothing
End Sub
每一次都显示第一行的值,郁闷!!!! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询