Jump to content
Fórum Script Brasil
  • 0

Comparar Textos de Duas RichTextBox e Destacar o Erro


nando.m

Question

olá sou novo aqui no forum, me desculpem se postei em lugar errado ou algo do tipo...

estou com um problema em um programa que estou fazendo, preciso comparar o texto de duas textboxs e destacar o caractere difirente (errado).

por exemplo assim que a pessoa digitar um caractere ele confere no textbox (estou usando timer) se o caractere digitado no rich..box2 for difirente do rich..box1 ele destaca com uma cor algo assim...

Aqui em baixo está o codigo do meu programa. por favor me ajudem!

Public Class Form2
    Dim Voice As Object

    Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
        Form3.Show()
        Me.Close()
    End Sub

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Form4.Show()
        Me.Close()
    End Sub

    Private Sub LinkLabel1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles LinkLabel1.MouseMove
        If LinkLabel1.LinkColor = Color.White Then
            LinkLabel1.LinkColor = Color.Lime
        Else
            LinkLabel1.LinkColor = Color.Lime
        End If

    End Sub

    Private Sub LinkLabel1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.MouseLeave
        If LinkLabel1.LinkColor = Color.Lime Then
            LinkLabel1.LinkColor = Color.White
        Else
            LinkLabel1.LinkColor = Color.Lime
        End If
    End Sub

    Private Sub LinkLabel2_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles LinkLabel2.MouseMove
        If LinkLabel2.LinkColor = Color.White Then
            LinkLabel2.LinkColor = Color.Lime
        Else
            LinkLabel2.LinkColor = Color.Lime
        End If

    End Sub

    Private Sub LinkLabel2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel2.MouseLeave
        If LinkLabel2.LinkColor = Color.Lime Then
            LinkLabel2.LinkColor = Color.White
        Else
            LinkLabel2.LinkColor = Color.Lime
        End If
    End Sub

    Private Sub LinkLabel3_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles LinkLabel3.MouseMove
        If LinkLabel3.LinkColor = Color.White Then
            LinkLabel3.LinkColor = Color.Lime
        Else
            LinkLabel3.LinkColor = Color.Lime
        End If

    End Sub

    Private Sub LinkLabel3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel3.MouseLeave
        If LinkLabel3.LinkColor = Color.Lime Then
            LinkLabel3.LinkColor = Color.White
        Else
            LinkLabel3.LinkColor = Color.Lime
        End If
    End Sub

    Private Sub LinkLabel4_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles LinkLabel4.MouseMove
        If LinkLabel4.LinkColor = Color.White Then
            LinkLabel4.LinkColor = Color.Lime
        Else
            LinkLabel4.LinkColor = Color.Lime
        End If

    End Sub

    Private Sub LinkLabel4_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel4.MouseLeave
        If LinkLabel4.LinkColor = Color.Lime Then
            LinkLabel4.LinkColor = Color.White
        Else
            LinkLabel4.LinkColor = Color.Lime
        End If
    End Sub

    Private Sub LinkLabel6_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
        If LinkLabel6.LinkColor = Color.White Then
            LinkLabel6.LinkColor = Color.Gray
        Else
            LinkLabel6.LinkColor = Color.Gray
        End If

    End Sub

    Private Sub LinkLabel6_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs)
        If LinkLabel6.LinkColor = Color.Gray Then
            LinkLabel6.LinkColor = Color.White
        Else
            LinkLabel6.LinkColor = Color.Gray
        End If
    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Form1.Hide()
    End Sub

    Private Sub LinkLabel4_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel4.LinkClicked
        Form1.Show()
        Me.Close()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = (Label1.Text + 1)
        If Label1.Text > 59 Then
            Label1.Text = "0"
            Label2.Text = (Label2.Text + 1)
        End If

    End Sub

    Private Sub RichTextBox2_KeyDown(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.KeyEventArgs) _
    Handles RichTextBox2.KeyDown
        ' Ao pressionar a tecla Delete eliminamos o elemento selecionado no listbox
        If e.KeyCode = Keys.Space Then
            Label6.Text = Label6.Text + 1
            If (RichTextBox2.Text = "Hoje") Then
                Label4.Text = Label4.Text + 1
            End If
            If (RichTextBox2.Text = "Hoje meu") Then
                Label4.Text = Label4.Text + 1
            End If
            If (RichTextBox2.Text = "Hoje meu dia") Then
                Label4.Text = Label4.Text + 1
            End If
        End If
    End Sub

    Private Sub Timer2_KeyDown(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.KeyEventArgs) _
    Handles RichTextBox2.KeyDown
        ' Ao pressionar a tecla Delete eliminamos o elemento selecionado no listbox
        If e.KeyCode = Keys.Back Then
            Label4.Text = Label4.Text - 1
        End If
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

        Label5.Text = RichTextBox2.Text.Length
        Label7.Text = RichTextBox2.Lines.Length

    End Sub

    Private Sub LinkLabel7_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel7.LinkClicked
        Timer1.Stop()
        Timer2.Stop()
    End Sub

    Private Sub LinkLabel6_LinkClicked_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel6.LinkClicked
        Timer1.Start()
        Timer2.Start()
        RichTextBox2.ReadOnly = False
    End Sub

    Private Sub LinkLabel8_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel8.LinkClicked
        Voice = CreateObject("SAPI.SpVoice")
        Voice.speak(RichTextBox1.Text)
    End Sub

    Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click

    End Sub

    Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click

    End Sub

    Private Sub RichTextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged

    End Sub
End Class

PS: Oque estou fazendo é uma espécie de "curso de digitação"

Edited by nando.m
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...