Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)End Sub
里面记录行号和列号,然后使用
里面记录行号和列号,然后使用
解决方案 »
- 上传了一个支持预览的vb文件、文件夹打开对话框类(代码)
- "strComp" 和"="进行字符串比较时哪一个速度快?
- dbgrid如何显示查询后的行数
- 请问在VB中,如何编制快速排序,堆排序,归并排序,基数排序???
- 再次提问关于水晶报表运行问题
- 帮我看个函数错误,谢谢
- 把记录集导出到EXCEL表的时候,怎么样用代码实现把记录集日期型字段对应的EXCEL列的属性设为DATE型
- 各位兄弟姐妹们,大家新年好啊!想请教一下如何判断网络打印机是否连通的问题。
- 有什么函数可以将按钮变成任意得形状,详情请进!
- ******纽约又落了架飞机!你说是谁干的?在结果未出来之前我们先来猜猜*******
- 条件:要求“对象”
- 请问怎样提供Form的返回值?
MsgBox LastRow
MsgBox LastCol
End SubPrivate Sub DataGridp_SelChange(Cancel As Integer)
MsgBox Cancel
End Sub
但是均返回不到正确的数,lastrow返回的是51x,好象也没什么规律,lastcol返回0-5
后面一个返回的也不对!
'注意这个属性: DataGrid1.MarqueeStyle
Option Explicit
Dim bIsRow As Boolean
Dim adoRecordset As New ADODB.Recordset
Dim adoConnection As New ADODB.Connection
Private Sub Form_Load()
'注意这个属性:
DataGrid1.MarqueeStyle = dbgHighlightRow
'=======================================
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\NWind97.mdb;Persist Security Info=False"
Set adoRecordset.ActiveConnection = adoConnection
adoRecordset.Properties("IRowsetIdentity").Value = True
adoRecordset.Open "SELECT * FROM 产品", , adOpenKeyset
Set DataGrid1.DataSource = adoRecordset
End Sub
Private Sub DataGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
bIsRow = (DataGrid1.RowContaining(Y) >= 0)
End Sub
Private Sub DataGrid1_DblClick()
If Not adoRecordset.BOF And Not adoRecordset.EOF And bIsRow Then
VBA.MsgBox adoRecordset.Fields.Item(0).Value
End If
End Sub
这个VBA是什么意思呢?
VBA.MsgBox adoRecordset.Fields.Item(0).Value
我直接用MSGBOX也可以!
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
MsgBox Rs("FiledName")
End Sub