I am trying to make a virtual help assistant in my program, something you can type errors or questions to and it answers them. The way I have done this is by making a dim that dims a word and then I give the dimmed word a load of words that might match it, then I added these words up to form sentences. A quick preview is below, but all I want to do is check the sentence against the textbox.text so for example if I done the following:
So you see I have added a few words that people might use to the dim function, so I am hoping to achieve if someone types "wat r u" then it comes back with the proper word which is what, by adding all 3 words to the "whatareyou" dim for the sentence I want to check this against the text box. Basically I want to search the textbox for any of these words and try to figure out what the user has asked. And then reply to their question like below:
txtSend is the name for the box were the user types their question, txtRead is the main box that displays the conversation and the button is just a normal control name. Any help with this would be fantastic, thanks!
I am kind of a noob at VB btw and I dont really use the Dim function as much as I probably should do, but I am guessing string is the wrong type to use?
VB.NET:
'This is the place to Dim words!
Dim what As String
Dim are As String
Dim you As String
'This is the place to Dim sentences!
Dim whatareyou As String
'Complete the words as follows: Dim = "Words"...
what = "what" & "wat" & "wot" & "wut"
are = "are" & "r" & "ar" & "arr" & "aar"
you = "you" & "u" & "yu" & "yuu" & "uu"
'Complete the sentences as follows: Sentence = Words...
whatareyou = what & are & you
So you see I have added a few words that people might use to the dim function, so I am hoping to achieve if someone types "wat r u" then it comes back with the proper word which is what, by adding all 3 words to the "whatareyou" dim for the sentence I want to check this against the text box. Basically I want to search the textbox for any of these words and try to figure out what the user has asked. And then reply to their question like below:
VB.NET:
If txtSend.Text = whatareyou Then
txtRead.Text = txtRead.Text & vbCrLf & "User: " & txtSend.Text & vbCrLf & "Help: I am a help assistant."
Else
txtRead.Text = txtRead.Text & vbCrLf & "User: " & txtSend.Text & vbCrLf & "Help: Sorry what did you say?"
txtSend.Text = ""
End If
txtSend is the name for the box were the user types their question, txtRead is the main box that displays the conversation and the button is just a normal control name. Any help with this would be fantastic, thanks!
I am kind of a noob at VB btw and I dont really use the Dim function as much as I probably should do, but I am guessing string is the wrong type to use?