|
-
May 23rd, 2001, 01:30 AM
#1
Thread Starter
Member
whats wrong
i tried a lot to get rid of the errors but i could'nt
please help me ' the error its giving is 'type missmatch'
Private Sub cmdFindNext_Click()
On Error GoTo error_handler
Dim position As long
Dim str1 As String
Dim str2 As String
str1 = frmEDITOR.rtbEditor.Text ' main form's text box(richtext box)
str2 = txtfind.Text 'just a text box
If chkMcase = vbChecked Then
position = InStr(str1, str2, vbBinaryCompare)
Else
position = InStr(str1, str2, vbTextCompare)
End If
Exit Sub
error_handler:
MsgBox Err.Description
End Sub
-
May 23rd, 2001, 01:44 AM
#2
First of all uncomment your On Error statement, and see which line causes the error.
-
May 23rd, 2001, 01:55 AM
#3
Member
Code:
Dim position As Long
Dim str1 As String
Dim str2 As String
str1 = "blah testing this out"
str2 = "testing"
position = InStr(1, str1, str2, vbBinaryCompare)
Debug.Print position
InStr([start],[string1],[string2],[Compare as VbCompareMethod])
You didn't give it a starting place in the InStr.
Matt Bradbury
An optimist will claim the glass is half full.
A pessimist that it is half empty.
I just think the glass is too big.
-
May 23rd, 2001, 02:12 AM
#4
Member
Hi,
if the type of compare is specified you have to say where he must start.
So use:
If chkMcase = vbChecked Then
position = InStr(1, str1, str2, vbBinaryCompare)
Else
position = InStr(1, str1, str2, vbTextCompare)
end if
Greetings.
VB, C/C++, ASP, HTML, Javascript, Java, SQL, VB.NET
-
May 23rd, 2001, 02:14 AM
#5
Member
Seem's like we posted on the same time rebelDev.
VB, C/C++, ASP, HTML, Javascript, Java, SQL, VB.NET
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|