Hi everyone.

There is a program that I'm writing and now I'm stuck here, What I'm doing is the verifier where I have 13 words and these words I've wrote them one each label that means I have 13 labels which are named w(number) e.g. label1 is named w1 and label2 is named w3 up to w13. I also have 10 textbox's which I just didn't name them so I left them in default mode. now the problem is stricking out the relevent label when that word is being typed on any textbox. Here is this these 13 words are words in which I choose the word and write it on the textbox and when the word has been writen to the textbox the word will be stricked out to indicate that the word has been choosed. Here is where I'm stuck, I tried using the Texbox_Change Handler but now I must track these words for 10 textbox's because I may type the word in any textbox but the system must detect it, I also tried using the Timer in which the next codes are wrote in timer.

Here is where I tried this by writing these codes in the one timer but the problem is that it will strick out the word when you typing in the first textbox but when you move on to the next textbox it just flick the strickeout of the next word or it just remove the strickeout from the word typed in textbox1.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        If w1.Font.Strikeout = True Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)
            If w1.Font.Strikeout = True Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            Else
                w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)
            End If
        End If
        ' TextBox1

        ' Word1
        If TextBox1.Text = "Binary code" Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout) ' Stricking out a word
        ElseIf TextBox1.Text = "binary code".ToLower Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox1.Text = "binary code".ToUpper Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            ' Removing font style
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)

            ' Word2
            If TextBox1.Text = "Access control" Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            ElseIf TextBox1.Text = "access control".ToLower Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            ElseIf TextBox1.Text = "access control".ToUpper Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            Else
                w2.Font = New Font(w2.Font, w2.Font.Style And Not FontStyle.Strikeout)

                ' Word3
                If TextBox1.Text = "Formulation of company policy" Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                ElseIf TextBox1.Text = "formulation of company policy".ToLower Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                ElseIf TextBox1.Text = "formulation of company policy".ToUpper Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                Else
                    w3.Font = New Font(w3.Font, w3.Font.Style And Not FontStyle.Strikeout)

                    ' Word4
                    If TextBox1.Text = "Electronic camera" Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    ElseIf TextBox1.Text = "electronic camera".ToLower Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    ElseIf TextBox1.Text = "electronic camera".ToUpper Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    Else
                        w4.Font = New Font(w4.Font, w4.Font.Style And Not FontStyle.Strikeout)

                        ' Word5
                        If TextBox1.Text = "Updated definitions" Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        ElseIf TextBox1.Text = "Updated definitions".ToLower Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        ElseIf TextBox1.Text = "Updated definitions".ToUpper Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        Else
                            w5.Font = New Font(w5.Font, w5.Font.Style And Not FontStyle.Strikeout)

                            ' Word6
                            If TextBox1.Text = "Qwerty" Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            ElseIf TextBox1.Text = "Qwerty".ToLower Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            ElseIf TextBox1.Text = "Qwerty".ToUpper Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            Else
                                w6.Font = New Font(w6.Font, w6.Font.Style And Not FontStyle.Strikeout)

                                ' Word7
                                If TextBox1.Text = "Virus prevention" Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                ElseIf TextBox1.Text = "Virus prevention".ToLower Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                ElseIf TextBox1.Text = "Virus prevention".ToUpper Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                Else
                                    w7.Font = New Font(w7.Font, w7.Font.Style And Not FontStyle.Strikeout)

                                    ' Word8
                                    If TextBox1.Text = "Softcopy" Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    ElseIf TextBox1.Text = "Softcopy".ToLower Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    ElseIf TextBox1.Text = "Softcopy".ToUpper Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    Else
                                        w8.Font = New Font(w8.Font, w8.Font.Style And Not FontStyle.Strikeout)

                                        ' Word9
                                        If TextBox1.Text = "Hard disk" Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        ElseIf TextBox1.Text = "Hard disk".ToLower Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        ElseIf TextBox1.Text = "Hard disk".ToUpper Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        Else
                                            w9.Font = New Font(w9.Font, w9.Font.Style And Not FontStyle.Strikeout)

                                            ' Word10
                                            If TextBox1.Text = "Quartz" Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            ElseIf TextBox1.Text = "Quartz".ToLower Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            ElseIf TextBox1.Text = "Quartz".ToUpper Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            Else
                                                w10.Font = New Font(w10.Font, w10.Font.Style And Not FontStyle.Strikeout)

                                                ' word11
                                                If TextBox1.Text = "Optical disks" Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                ElseIf TextBox1.Text = "Optical disks".ToLower Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                ElseIf TextBox1.Text = "Optical disks".ToUpper Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                Else
                                                    w11.Font = New Font(w11.Font, w11.Font.Style And Not FontStyle.Strikeout)

                                                    ' Word12
                                                    If TextBox1.Text = "Hardcopy" Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    ElseIf TextBox1.Text = "Hardcopy".ToLower Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    ElseIf TextBox1.Text = "Hardcopy".ToUpper Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    Else
                                                        w12.Font = New Font(w12.Font, w12.Font.Style And Not FontStyle.Strikeout)

                                                        ' Word13
                                                        If TextBox1.Text = "Knowledge" Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        ElseIf TextBox1.Text = "Knowledge".ToLower Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        ElseIf TextBox1.Text = "Knowledge".ToUpper Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        Else
                                                            w13.Font = New Font(w13.Font, w13.Font.Style And Not FontStyle.Strikeout)

                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

        ' TextBox2

        ' Word1
        If TextBox2.Text = "Binary code" Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox2.Text = "binary code".ToLower Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox2.Text = "binary code".ToUpper Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            ' Removing font style
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)

            ' Word2
            If TextBox2.Text = "Access control" Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            ElseIf TextBox2.Text = "access control".ToLower Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            ElseIf TextBox2.Text = "access control".ToUpper Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            Else
                w2.Font = New Font(w2.Font, w2.Font.Style And Not FontStyle.Strikeout)

                ' Word3
                If TextBox2.Text = "Formulation of company policy" Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                ElseIf TextBox2.Text = "formulation of company policy".ToLower Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                ElseIf TextBox2.Text = "formulation of company policy".ToUpper Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                Else
                    w3.Font = New Font(w3.Font, w3.Font.Style And Not FontStyle.Strikeout)

                    ' Word4
                    If TextBox2.Text = "Electronic camera" Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    ElseIf TextBox2.Text = "electronic camera".ToLower Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    ElseIf TextBox2.Text = "electronic camera".ToUpper Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    Else
                        w4.Font = New Font(w4.Font, w4.Font.Style And Not FontStyle.Strikeout)

                        ' Word5
                        If TextBox2.Text = "Updated definitions" Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        ElseIf TextBox2.Text = "Updated definitions".ToLower Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        ElseIf TextBox2.Text = "Updated definitions".ToUpper Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        Else
                            w5.Font = New Font(w5.Font, w5.Font.Style And Not FontStyle.Strikeout)

                            ' Word6
                            If TextBox2.Text = "Qwerty" Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            ElseIf TextBox2.Text = "Qwerty".ToLower Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            ElseIf TextBox2.Text = "Qwerty".ToUpper Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            Else
                                w6.Font = New Font(w6.Font, w6.Font.Style And Not FontStyle.Strikeout)

                                ' Word7
                                If TextBox2.Text = "Virus prevention" Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                ElseIf TextBox2.Text = "Virus prevention".ToLower Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                ElseIf TextBox2.Text = "Virus prevention".ToUpper Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                Else
                                    w7.Font = New Font(w7.Font, w7.Font.Style And Not FontStyle.Strikeout)

                                    ' Word8
                                    If TextBox2.Text = "Softcopy" Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    ElseIf TextBox2.Text = "Softcopy".ToLower Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    ElseIf TextBox2.Text = "Softcopy".ToUpper Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    Else
                                        w8.Font = New Font(w8.Font, w8.Font.Style And Not FontStyle.Strikeout)

                                        ' Word9
                                        If TextBox2.Text = "Hard disk" Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        ElseIf TextBox2.Text = "Hard disk".ToLower Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        ElseIf TextBox2.Text = "Hard disk".ToUpper Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        Else
                                            w9.Font = New Font(w9.Font, w9.Font.Style And Not FontStyle.Strikeout)

                                            ' Word10
                                            If TextBox2.Text = "Quartz" Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            ElseIf TextBox2.Text = "Quartz".ToLower Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            ElseIf TextBox2.Text = "Quartz".ToUpper Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            Else
                                                w10.Font = New Font(w10.Font, w10.Font.Style And Not FontStyle.Strikeout)

                                                ' word11
                                                If TextBox2.Text = "Optical disks" Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                ElseIf TextBox2.Text = "Optical disks".ToLower Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                ElseIf TextBox2.Text = "Optical disks".ToUpper Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                Else
                                                    w11.Font = New Font(w11.Font, w11.Font.Style And Not FontStyle.Strikeout)

                                                    ' Word12
                                                    If TextBox2.Text = "Hardcopy" Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    ElseIf TextBox2.Text = "Hardcopy".ToLower Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    ElseIf TextBox2.Text = "Hardcopy".ToUpper Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    Else
                                                        w12.Font = New Font(w12.Font, w12.Font.Style And Not FontStyle.Strikeout)

                                                        ' Word13
                                                        If TextBox2.Text = "Knowledge" Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        ElseIf TextBox2.Text = "Knowledge".ToLower Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        ElseIf TextBox2.Text = "Knowledge".ToUpper Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        Else
                                                            w13.Font = New Font(w13.Font, w13.Font.Style And Not FontStyle.Strikeout)


                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

        ' TextBox3

        ' Word1
        If TextBox3.Text = "Binary code" Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox3.Text = "binary code".ToLower Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox3.Text = "binary code".ToUpper Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            ' Removing font style
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)

            ' Word2
            If TextBox3.Text = "Access control" Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            ElseIf TextBox3.Text = "access control".ToLower Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            ElseIf TextBox3.Text = "access control".ToUpper Then
                w2.Font = New Font(w2.Font, w2.Font.Style Or FontStyle.Strikeout)
            Else
                w2.Font = New Font(w2.Font, w2.Font.Style And Not FontStyle.Strikeout)

                ' Word3
                If TextBox3.Text = "Formulation of company policy" Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                ElseIf TextBox3.Text = "formulation of company policy".ToLower Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                ElseIf TextBox3.Text = "formulation of company policy".ToUpper Then
                    w3.Font = New Font(w3.Font, w3.Font.Style Or FontStyle.Strikeout)
                Else
                    w3.Font = New Font(w3.Font, w3.Font.Style And Not FontStyle.Strikeout)

                    ' Word4
                    If TextBox3.Text = "Electronic camera" Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    ElseIf TextBox3.Text = "electronic camera".ToLower Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    ElseIf TextBox3.Text = "electronic camera".ToUpper Then
                        w4.Font = New Font(w4.Font, w4.Font.Style Or FontStyle.Strikeout)
                    Else
                        w4.Font = New Font(w4.Font, w4.Font.Style And Not FontStyle.Strikeout)

                        ' Word5
                        If TextBox3.Text = "Updated definitions" Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        ElseIf TextBox3.Text = "Updated definitions".ToLower Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        ElseIf TextBox3.Text = "Updated definitions".ToUpper Then
                            w5.Font = New Font(w5.Font, w5.Font.Style Or FontStyle.Strikeout)
                        Else
                            w5.Font = New Font(w5.Font, w5.Font.Style And Not FontStyle.Strikeout)

                            ' Word6
                            If TextBox3.Text = "Qwerty" Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            ElseIf TextBox3.Text = "Qwerty".ToLower Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            ElseIf TextBox3.Text = "Qwerty".ToUpper Then
                                w6.Font = New Font(w6.Font, w6.Font.Style Or FontStyle.Strikeout)
                            Else
                                w6.Font = New Font(w6.Font, w6.Font.Style And Not FontStyle.Strikeout)

                                ' Word7
                                If TextBox3.Text = "Virus prevention" Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                ElseIf TextBox3.Text = "Virus prevention".ToLower Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                ElseIf TextBox3.Text = "Virus prevention".ToUpper Then
                                    w7.Font = New Font(w7.Font, w7.Font.Style Or FontStyle.Strikeout)
                                Else
                                    w7.Font = New Font(w7.Font, w7.Font.Style And Not FontStyle.Strikeout)

                                    ' Word8
                                    If TextBox3.Text = "Softcopy" Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    ElseIf TextBox3.Text = "Softcopy".ToLower Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    ElseIf TextBox3.Text = "Softcopy".ToUpper Then
                                        w8.Font = New Font(w8.Font, w8.Font.Style Or FontStyle.Strikeout)
                                    Else
                                        w8.Font = New Font(w8.Font, w8.Font.Style And Not FontStyle.Strikeout)

                                        ' Word9
                                        If TextBox3.Text = "Hard disk" Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        ElseIf TextBox3.Text = "Hard disk".ToLower Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        ElseIf TextBox3.Text = "Hard disk".ToUpper Then
                                            w9.Font = New Font(w9.Font, w9.Font.Style Or FontStyle.Strikeout)
                                        Else
                                            w9.Font = New Font(w9.Font, w9.Font.Style And Not FontStyle.Strikeout)

                                            ' Word10
                                            If TextBox3.Text = "Quartz" Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            ElseIf TextBox3.Text = "Quartz".ToLower Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            ElseIf TextBox3.Text = "Quartz".ToUpper Then
                                                w10.Font = New Font(w10.Font, w10.Font.Style Or FontStyle.Strikeout)
                                            Else
                                                w10.Font = New Font(w10.Font, w10.Font.Style And Not FontStyle.Strikeout)

                                                ' word11
                                                If TextBox3.Text = "Optical disks" Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                ElseIf TextBox3.Text = "Optical disks".ToLower Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                ElseIf TextBox3.Text = "Optical disks".ToUpper Then
                                                    w11.Font = New Font(w11.Font, w11.Font.Style Or FontStyle.Strikeout)
                                                Else
                                                    w11.Font = New Font(w11.Font, w11.Font.Style And Not FontStyle.Strikeout)

                                                    ' Word12
                                                    If TextBox3.Text = "Hardcopy" Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    ElseIf TextBox3.Text = "Hardcopy".ToLower Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    ElseIf TextBox3.Text = "Hardcopy".ToUpper Then
                                                        w12.Font = New Font(w12.Font, w12.Font.Style Or FontStyle.Strikeout)
                                                    Else
                                                        w12.Font = New Font(w12.Font, w12.Font.Style And Not FontStyle.Strikeout)

                                                        ' Word13
                                                        If TextBox3.Text = "Knowledge" Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        ElseIf TextBox3.Text = "Knowledge".ToLower Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        ElseIf TextBox3.Text = "Knowledge".ToUpper Then
                                                            w13.Font = New Font(w13.Font, w13.Font.Style Or FontStyle.Strikeout)
                                                        Else
                                                            w13.Font = New Font(w13.Font, w13.Font.Style And Not FontStyle.Strikeout)


                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End Sub

I also tried separating the code by puting the timer for each textbox so that each textbox will be tracked by it own timer but it seems as if the codes are bumping to one another because I repeted the same formular from textbox1 to textbox3 which are as follows for the fisrt word in every textbox.

Textbox1

If TextBox1.Text = "Binary code" Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox1.Text = "binary code".ToLower Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox1.Text = "binary code".ToUpper Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            ' Removing font style
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)
            .
            .
            .
            .
            .
            End If

Texbox2

If TextBox2.Text = "Binary code" Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox2.Text = "binary code".ToLower Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox2.Text = "binary code".ToUpper Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            ' Removing font style
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)
            .
            .
            .
            .
            .
            End If

Texbox3

If TextBox3.Text = "Binary code" Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox3.Text = "binary code".ToLower Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        ElseIf TextBox3.Text = "binary code".ToUpper Then
            w1.Font = New Font(w1.Font, w1.Font.Style Or FontStyle.Strikeout)
        Else
            ' Removing font style
            w1.Font = New Font(w1.Font, w1.Font.Style And Not FontStyle.Strikeout)
            .
            .
            .
            .
            .
            End If

any one who can help me here please.

Recommended Answers

All 6 Replies

You might find this code helpful. It will take whatever text is typed in any textbox and if it equals the text in any of the labels it will strikeout the text in that label:

Public Class Form1
    Dim AllTextBoxes As New List(Of TextBox)
    Dim AllLabels As New List(Of Label)
    Dim SearchStr As String = ""
    Dim StrikeoutFont As Font = Me.Font
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AllLabels = Me.Controls.OfType(Of Label).ToList
        For Each tb As TextBox In Me.Controls.OfType(Of TextBox)()
            AllTextBoxes.Add(tb)
            AddHandler tb.TextChanged, AddressOf TextBox_TextChanged
        Next
    End Sub

    Private Sub TextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        SearchStr = DirectCast(sender, TextBox).Text
        Dim Indx As Integer = AllLabels.FindIndex(AddressOf FindLabel)
        If Indx <> -1 Then
            AllLabels(Indx).Font = New Font(AllLabels(Indx).Font, FontStyle.Strikeout)
        End If
    End Sub
    Private Function FindLabel(ByVal l As Label) as Boolean
        Return l.Text = SearchStr
    End Function
End Class

When you need to reset the labels a simple For Each loop to change the style back to regular should work.

You could get rid of 90% of your code by trying the following:

Create a dictionary where the key is a word in the word list and the value is the address of the associated label. For example (using 3 words and labels)

Private wordlist As New Dictionary(Of String, Label) From {
    {"the", Label1},
    {"quick", Label2},
    {"brown", Label3}
}

Then you can use the same handler for all of the textboxes. You can add the handlers at run time by

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    AddHandler TextBox1.Leave, AddressOf TextBox_Leave
    AddHandler TextBox2.Leave, AddressOf TextBox_Leave
    AddHandler TextBox3.Leave, AddressOf TextBox_Leave
End Sub

Then you code up one handler as follows:

Private Sub TextBox_Leave(sender As System.Object, e As System.EventArgs)

    Dim tbox As TextBox = sender
    Dim word As String = tbox.Text

    If wordlist.CoontainsKey(word) Then
        Dim lbl As Label = wordlist(word)
        'process that label here
    End If

End Sub

You can use a different event if you prefer. The above handler would fire whenever a textbox loses focus.

Thanks

Tinstaafl

You might find this code helpful. It will take whatever text is typed in any textbox and if it equals the text in any of the labels it will strikeout the text in that label:

your code was almost or is what I need but the thing is that when I put that code on this form I'm working with it doesn't do anything but if I create a new project and past them there it works, I thing the problem

1) may be coursed by that I have many labels there which are the question in which when you typing on a textbox you are answering that particular question or

2) it maybe coursed by that these textbox's that are holding this names I've renamed them from their default to my naming which is w(number for that word) e.g. w1 up to w13

and to Reverend Jim

Create a dictionary wher

I can understand everything in your codes but the problem I've discovered is that the Dictionary list is not working or the whole code but only for ditionary part is detected as error it underlines it and says syntax error I thing those codes are for C# or C++ I'm not sure of those Languagies but other codes are fine just the listing words in ditionary I don't know whethere you can write it in VB.net language.

1) may be coursed by that I have many labels there which are the question in which when you typing on a textbox you are answering that particular question or

In my code in the Form Load handler try this:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    For Each ctrl As Control In Me.Controls
        If ctrl.Name.Contains("Answer") Then
            AllLabels.Add(ctrl)
        ElseIf ctrl.Name.Contains("TextBox") Then
            AllTextBoxes.Add(ctrl)
            AddHandler ctrl.TextChanged, AddressOf TextBox_TextChanged
        End If
    Next
End Sub

Forgot to mention, to make the labels with the answers have unique names like, Answer1, Answer2, etc.

In my code in the Form Load handler try this:

Thank you but These codes didn't work not even if I create a new project it just don't function at all so what I've just decided is to create or simple add a new form that will deal with this potion I will be using your first codes that you firstly posted but the problem is with the strickout when the user has just typed a word on a textbox it strick it out so I want it to unstrick it when the user is removing the word from the textbox. Then after that I will use my codes to complete this project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.