关于查找字符的问题

bulletxh 2005-12-16 03:49:56
Public Sub findstr(rtb As RichTextBox)
Dim l1, l2 As Long
If Form1.findstr <> "" Then
SendMessageByRef rtb.hwnd, EM_GETSEL, l1, l2
If rtb.Find(Form1.findstr, l2) = -1 Then
l2 = 0
If rtb.Find(Form1.findstr, l2) = -1 Then
MsgBox "没有找到", vbOKOnly, ""
End If
End If
End If
End Sub
Dim strFind As String
Property Get findstr() As String
findstr = strFind
End Property
Property Let findstr(sFind As String)
strFind = sFind
End Property

运行时,提示发现二义性的名称:findstr
这段是在FORM1的通用下的代码
也是按照书上说的做的,但是我不能很清晰的理解这段代码的意思
并且为什么出现这样的错误提示?
请大虾给出指导性的意见,小弟跪求
...全文
给本帖投票
180 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
bulletxh 2005-12-22
  • 打赏
  • 举报
回复
TO zou19820704(国际海员)
谢谢你的代码
给了我启发
zou19820704 2005-12-21
  • 打赏
  • 举报
回复
Private Sub Command1_Click()

Dim cop As Integer
str = Form2.Text1.Text
str02 = Form2.Text2.Text
lentxt = Len(Text1.Text)
For i = 1 To Len(Form1.Text1.Text)
str01 = Mid(str, i, lentxt)
If str02 = str01 Then
msgbox "Be Found"
Exit For
End If
Next i
在text1里面找text2的字符



End Sub
bulletxh 2005-12-20
  • 打赏
  • 举报
回复
有哪位大虾有更好,更简洁的查找字符的代码吗?
有的话,请给小弟一段代码。
bulletxh 2005-12-19
  • 打赏
  • 举报
回复
我把这句Public Sub findstr(rtb As RichTextBox)
改成Public Sub findstrrtb(rtb As RichTextBox)
但是我还是不能很好的理解这段代码的意思,请各位大虾解释一下!
northwolves 2005-12-18
  • 打赏
  • 举报
回复
人为重名了
oho1937 2005-12-16
  • 打赏
  • 举报
回复
又是属性又是过程自然就二意了
选一个改名字.
bbhere 2005-12-16
  • 打赏
  • 举报
回复
Public Sub findstr(rtb As RichTextBox)
Property Get findstr() As String

1,488

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
社区公告
暂无公告

试试用AI创作助手写篇文章吧

手机看
关注公众号

关注公众号

客服 返回
顶部