Public Sub MyFunction()
Dim lowstring As String
lowstring = "hi"
Me.RichTextView.Find(lowstring, 0, 2)
End Sub
The above produces the error of
Overload resolution failed because no accessible
'Find'can be called without a narrowing conversion:
Public Function Find(characterSet() As Char, start As Integer, end As Integer) As Integer:Argument matching parameter
'characterSet'narrows
from'String'to'1-dimensional array of Char'.
Public Function Find(str As String, start As Integer, options As System.Windows.Forms.RichTextBoxFinds) As Integer:Argument matching parameter
'options'narrows from'Integer'to
'System.Windows.Forms.RichTextBoxFinds'.
The error doesn’t occur if you change the replacement string value, only if you change the second or third values to something other than 0.
Why doesn’t the use of standard integers work here? What does this error really mean? Can anyone point me to some documentation for handling overloaded functions in vb.net (2010)?
I hope this question is focused enough… I’ve just been pretty confused about this one.
Thanks for any help – EB
As you can see,
RichTextBox.Findhas 7 overloads.The one you’re calling with 3 arguments and two integers takes a
Char[]as first parameter, not aString.This overload is used when you want to find the first instance of a character from a list of characters.
I assume that you want to find the position of your
stringin a given range. Then you need to use this overload:RichTextBox.Find(String, Int32, Int32, RichTextBoxFinds).For example:
Note that you can combine different
RichTextBoxFindsbitwise.For example: