Private Sub Command1_Click()
Dim target_name As String
Dim r As Integer ' Get the name.
target_name = InputBox("Name", "Name", "")
If Len(target_name) = 0 Then Exit Sub ' Search for the name, skipping the column heading row.
target_name = LCase$(target_name)
For r = 1 To MSFlexGrid1.Rows - 1
If LCase$(MSFlexGrid1.TextMatrix(r, 0)) = target_name Then
' We found the target. Select this row.
MSFlexGrid1.Row = r
MSFlexGrid1.RowSel = r
MSFlexGrid1.Col = 0
MSFlexGrid1.ColSel = MSFlexGrid1.Cols - 1 ' Make the row visible.
MSFlexGrid1.TopRow = r
Exit Sub
End If
Next r ' We didn't find it.
Beep
Dim target_name As String
Dim r As Integer ' Get the name.
target_name = InputBox("Name", "Name", "")
If Len(target_name) = 0 Then Exit Sub ' Search for the name, skipping the column heading row.
target_name = LCase$(target_name)
For r = 1 To MSFlexGrid1.Rows - 1
If LCase$(MSFlexGrid1.TextMatrix(r, 0)) = target_name Then
' We found the target. Select this row.
MSFlexGrid1.Row = r
MSFlexGrid1.RowSel = r
MSFlexGrid1.Col = 0
MSFlexGrid1.ColSel = MSFlexGrid1.Cols - 1 ' Make the row visible.
MSFlexGrid1.TopRow = r
Exit Sub
End If
Next r ' We didn't find it.
Beep
解决方案 »
- 狂甩100分跪求例子
- 真是怪了,我的一个项目组,每次打开后,什么也不同直接关闭,还是提示是否保存项目组和项目,这是为什么呀?
- 如何判断鼠标移出了窗体?
- MScomm的一个怪现象
- 500分求如何截获Word打印预览的所有图片.急急急!!!!
- 如何用ado或rdo执行sqlserver2000 的 Exec指令?
- 小白向各位请教下VB过滤广告的问题
- 最近用尝试用VB做DLL,有问题请大家指教一下。
- 关于将MDAC打包的问题
- “System.NullReferenceException”类型的未经处理的异常 其他信息: 未将对象引用设置到对象的实例。
- mshflexgrid带区与DataEnvironment绑定的刷新问题?
- 见面有分,wps 文件格式问题
For i = 0 To rs.RecordCount - 1
For j = 0 To rs.Fields.Count - 1
editclass.Row = i
editclass.Col = j
If Trim(editclass.Text) = "a" Then
editclass.Text = ""
Else
......
If rs.EOF Then MsgBox "已搜索指定的区域! ": Exit Sub
End If
Next j
Next i
为什么在editclass.Row = i错误提示"行号无效"
此时i=8,editclass.row=1
为什么会这样呢?