-3

I'm making a simple chatbot that acts like my friend.

(Example) if inputtxt contains the word "water" then outputtxt says "Water falls from the sky." So if the inputtxt says "What do you think of water" it will recognize water and says "Water falls from the sky."

I've been messing with it all day but can't get it. I also want it to be in select case form.

Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
JoshPaulie
  • 78
  • 1
  • 7

3 Answers3

0

Do you mean this?

Private Sub inputtxt_TextChanged(sender As Object, e As EventArgs) Handles inputtxt.TextChanged
    Dim input As String = inputtxt.Text
    Select Case input
        Case input = "water"
            outputtxt.Text = "Water falls from the sky."
        Case input = "What do you think of water"
            outputtxt.Text = "Water falls from the sky."
        Case Else
            outputtxt.Text = "Please input a string!!"
    End Select
End Sub
RobotHanzo
  • 11
  • 1
  • 4
0

I got it. I did the following

    Dim InputStringDing As String = InputTxtBox.Text.ToLower
    Select Case True
        Case InputStringDing.Contains("water")
            OutputRTB.Text += "Tommy: " & "Water falls from the sky!"
    End Select

I'd really like to thank whoever downvoted. That's a really good way to help people trying to learn vb. What if someone else has the same question? They wouldn't want to click on the -1 would they? Really good community I see.

Thank you for trying to help

JoshPaulie
  • 78
  • 1
  • 7
0
If textbox.text.Contains("water") then output = "Water falls from the sky."

I dont advice you to use select case for this."If" will work better

  • It would but I had more than just "water," and a select case was either than adding more and more else then's – JoshPaulie Sep 22 '17 at 22:10