Валерий Алексеевич Жарков

Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 5: Программирование искусственного интеллекта на Visual Basic (продолжение 1)


Скачать книгу

str(16) = "d" Then

      Chr3.Text = "D"

      End If

      If str(17) = "d" Then

      Chr2.Text = "D"

      End If

      If str(18) = "d" Then

      Chr1.Text = "D"

      End If

      ElseIf Word_in.TextLength = 20 Then

      If str(0) = "d" Then

      Chr20.Text = "D"

      End If

      If str(1) = "d" Then

      Chr19.Text = "D"

      End If

      If str(2) = "d" Then

      Chr18.Text = "D"

      End If

      If str(3) = "d" Then

      Chr17.Text = "D"

      End If

      If str(4) = "d" Then

      Chr16.Text = "D"

      End If

      If str(5) = "d" Then

      Chr15.Text = "D"

      End If

      If str(6) = "d" Then

      Chr14.Text = "D"

      End If

      If str(7) = "d" Then

      Chr13.Text = "D"

      End If

      If str(8) = "d" Then

      Chr12.Text = "D"

      End If

      If str(9) = "d" Then

      Chr11.Text = "D"

      End If

      If str(10) = "d" Then

      Chr10.Text = "D"

      End If

      If str(11) = "d" Then

      Chr9.Text = "D"

      End If

      If str(12) = "d" Then

      Chr8.Text = "D"

      End If

      If str(13) = "d" Then

      Chr7.Text = "D"

      End If

      If str(14) = "d" Then

      Chr6.Text = "D"

      End If

      If str(15) = "d" Then

      Chr5.Text = "D"

      End If

      If str(16) = "d" Then

      Chr4.Text = "D"

      End If

      If str(17) = "d" Then

      Chr3.Text = "D"

      End If

      If str(18) = "d" Then

      Chr2.Text = "D"

      End If

      If str(19) = "d" Then

      Chr1.Text = "D"

      End If

      End If

      If InStr(Word_in.Text, "d", CompareMethod.Text) = 0 Then

      If f_chr1.Text = "" Then

      f_chr1.Text = "D"

      ElseIf f_chr2.Text = "" Then

      f_chr2.Text = "D"

      ElseIf f_chr3.Text = "" Then

      f_chr3.Text = "D"

      ElseIf f_chr4.Text = "" Then

      f_chr4.Text = "D"

      ElseIf f_chr5.Text = "" Then

      f_chr5.Text = "D"

      ElseIf f_chr6.Text = "" Then

      f_chr6.Text = "D"

      ElseIf f_chr7.Text = "" Then

      f_chr7.Text = "D"

      ElseIf f_chr8.Text = "" Then

      f_chr8.Text = "D"

      ElseIf f_chr9.Text = "" Then

      f_chr9.Text = "D"

      ElseIf f_chr10.Text = "" Then

      f_chr10.Text = "D"

      ElseIf f_chr11.Text = "" Then

      f_chr11.Text = "D"

      End If

      End If

      End Sub

      Дважды щёлкаем по кнопке Button с именем Name для 5-й буквы Er (объяснение, почему здесь не E, а Er, дано выше). Появившийся шаблон метода после записи нашего кода принимает следующий вид.

      Листинг 19.6. Метод-обработчик щелчка кнопки.

      Private Sub E_Click(ByVal sender As System.Object, _

      ByVal e As System.EventArgs) Handles Er.Click

      Er.Enabled = False

      nums = Len(Word_in.Text)

      Try

      str(0) = Mid(Word_in.Text, nums, 1)

      str(1) = Mid(Word_in.Text, nums – 1, 1)

      str(2) = Mid(Word_in.Text, nums – 2, 1)

      str(3) = Mid(Word_in.Text, nums – 3, 1)

      str(4) = Mid(Word_in.Text, nums – 4, 1)

      str(5) = Mid(Word_in.Text, nums – 5, 1)

      str(6) = Mid(Word_in.Text, nums – 6, 1)

      str(7) = Mid(Word_in.Text, nums – 7, 1)

      str(8) = Mid(Word_in.Text, nums – 8, 1)

      str(9) = Mid(Word_in.Text, nums – 9, 1)

      str(10) = Mid(Word_in.Text, nums – 10, 1)

      str(11) = Mid(Word_in.Text, nums – 11, 1)

      str(12) = Mid(Word_in.Text, nums – 12, 1)

      str(13) = Mid(Word_in.Text, nums – 13, 1)

      str(14) = Mid(Word_in.Text, nums – 14, 1)

      str(15) = Mid(Word_in.Text, nums – 15, 1)

      str(16) = Mid(Word_in.Text, nums – 16, 1)

      str(17) = Mid(Word_in.Text, nums – 17, 1)

      str(18) = Mid(Word_in.Text, nums – 18, 1)

      str(19) = Mid(Word_in.Text, nums – 19, 1)

      Catch ex As Exception

      End Try

      If Word_in.TextLength = 1 Then

      If str(0) = "e" Then

      Chr1.Text = "E"

      End If

      ElseIf Word_in.TextLength = 2 Then

      If str(1) = "e" Then

      Chr1.Text = "E"

      End If

      If str(0) = "e" Then

      Chr2.Text = "E"

      End If

      ElseIf Word_in.TextLength = 3 Then

      If str(0) = "e" Then

      Chr3.Text = "E"

      End If

      If str(1) = "e" Then

      Chr2.Text = "E"

      End If

      If str(2) = "e" Then

      Chr1.Text = "E"

      End