Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Ist es wirklich die gleiche Meldung wie im Ausgangspost?
Dort wird ja angemeckert das -1 an SelectionStart übergeben wird.
Und laut dir (und dem Code) sollte dies ja nicht der Fall sein.
RichTextBox2.Find("insert", lpos, RichTextBoxFinds.WholeWord Or RichTextBoxFinds.NoHighlight);
Ging nicht wirklich^^Du könntest höchstens mal
probieren. (Sollte richtig sein, kenn mich aber nicht so gut mit VB aus)Code:RichTextBox2.Find("insert", lpos, RichTextBoxFinds.WholeWord Or RichTextBoxFinds.NoHighlight);
Dim lpos As Integer = 0
Dim myfont As New Font("Arial", 10, FontStyle.Bold)
Dim mycolor As Color = Color.Red
Dim wgot As Integer
Dim time1 As Date
Dim time2 As Date
Dim time3 As TimeSpan
Public Function FindMyText(ByVal text As String, ByVal start As Integer) As Integer
' Initialize the return value to false by default.
Dim returnValue As Integer = -1
' Ensure that a search string has been specified and a valid start point.
If text.Length > 0 And start >= 0 Then
' Obtain the location of the search string in richTextBox1.
Dim indexToText As Integer = RichTextBox2.Find(text, start, _
RichTextBoxFinds.MatchCase)
' Determine whether the text was found in richTextBox1.
If indexToText >= 0 Then
returnValue = indexToText
End If
End If
Return returnValue
End Function
Private Sub RichTextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged
time3 = time2.Subtract(time1)
wgot = time3.Milliseconds
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim hilfsvar As Integer = FindMyText("insert", lpos)
If (hilfsvar <> -1) Then
With RichTextBox2
.SelectionStart = hilfsvar
.SelectionFont = myfont
.SelectionColor = mycolor
.DeselectAll()
End With
End If
If ((time3.Milliseconds - wgot) >= 500) Then
Timer1.Stop()
End If
End Sub
Dim lpos As Integer = 0
Dim myfont As New Font("Arial", 10, FontStyle.Bold)
Dim mycolor As Color = Color.Red
Public Function FindMyText(ByVal text As String, ByVal start As Integer) As Integer
' Initialize the return value to false by default.
Dim returnValue As Integer = -1
' Ensure that a search string has been specified and a valid start point.
If text.Length > 0 And start >= 0 Then
' Obtain the location of the search string in richTextBox1.
Dim indexToText As Integer = RichTextBox2.Find(text, start, _
RichTextBoxFinds.MatchCase)
' Determine whether the text was found in richTextBox1.
If indexToText >= 0 Then
returnValue = indexToText
End If
End If
Return returnValue
End Function
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
Dim hilfsvar As Integer = FindMyText("insert", lpos)
If (hilfsvar <> -1) Then
RichTextBox2.SelectionStart = hilfsvar
If (RichTextBox2.SelectionColor = Color.Black) Then
With RichTextBox2
.SelectionFont = myfont
.SelectionColor = mycolor
.DeselectAll()
End With
Else
RichTextBox2.DeselectAll()
End If
End If
End Sub
Private Sub RichTextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged
Timer1.Stop()
Timer1.Start()
End Sub
Dim oldSel As Integer = RichTextBox2.SelectionStart
'---FindMyText Zeuchs-----
Dim hilfsvar As Integer = FindMyText("insert", lpos)
If (hilfsvar <> -1) Then
RichTextBox2.SelectionStart = hilfsvar
If (RichTextBox2.SelectionColor = Color.Black) Then
With RichTextBox2
.SelectionFont = myfont
.SelectionColor = mycolor
.DeselectAll()
End With
Else
RichTextBox2.DeselectAll()
End If
End If
'-----------
RichTextBox2.SelectionStart = oldSel
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
Dim hilfsvar As Integer = FindMyText("insert", lpos)
If (hilfsvar <> -1) Then
RichTextBox2.SelectionStart = hilfsvar
If (RichTextBox2.SelectionColor = Color.Black) Then
lpos = hilfsvar + RichTextBox2.SelectionLength
With RichTextBox2
.SelectionFont = myfont
.SelectionColor = mycolor
.DeselectAll()
End With
Else
lpos = hilfsvar + RichTextBox2.SelectionLength
RichTextBox2.DeselectAll()
End If
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
Dim hilfsvar As Integer = FindMyText("insert", lpos)
If (hilfsvar <> -1) Then
If (hilfsvar < RichTextBox2.TextLength) Then
RichTextBox2.SelectionStart = hilfsvar
If (RichTextBox2.SelectionColor = Color.Black) Then
lpos = hilfsvar + RichTextBox2.SelectionLength
With RichTextBox2
.SelectionFont = myfont
.SelectionColor = mycolor
.DeselectAll()
End With
Else
lpos = hilfsvar + RichTextBox2.SelectionLength
RichTextBox2.DeselectAll()
End If
Else
lpos = 0
End If
End If
End Sub