Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- 'These are the variables taht I will be using in this program
- Dim PhoneKeywords(9) As String
- Dim SearchWord As String
- Dim answer As String
- Dim response As String
- Dim KeywordFound As String
- Dim Test As String
- Dim filename = "N:\PhoneKeywords.txt"
- Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
- Test = "g"
- 'These are the keywords that will be identified
- PhoneKeywords(0) = "screen"
- PhoneKeywords(1) = "sound"
- PhoneKeywords(2) = "internet"
- PhoneKeywords(3) = "water"
- PhoneKeywords(4) = "turn"
- PhoneKeywords(5) = "respond"
- PhoneKeywords(6) = "blank"
- PhoneKeywords(7) = "dropped"
- PhoneKeywords(8) = "service"
- PhoneKeywords(9) = "bluetooth"
- 'This is the question that will be asked
- answer = InputBox("Welcome to the new and improved phone troubleshooter! What's wrong with your phone " & cmboxDevice.Text & " User?")
- Dim words As String() = answer.Split(New Char() {" "})
- 'This part of the code identifies whether there is a keyword in the user's answer
- For Each word In words
- For a = 0 To 9
- If word = PhoneKeywords(a) Then
- Test = (PhoneKeywords(a))
- End If
- Next a
- Next word
- KeywordFound = False
- 'This takes a response to use depending on what keyword was found
- FileOpen(1, filename, OpenMode.Input)
- Do While Not EOF(1)
- Input(1, SearchWord)
- Input(1, response)
- If Test = SearchWord Then
- MsgBox(response)
- KeywordFound = True
- End If
- Loop
- FileClose(1)
- 'This part of the code makes the program show a message saying the user's answer was invalid if a keyword was not found in the user's answer
- If KeywordFound = False Then
- MsgBox("Sorry, your answer was invalid, please try again")
- End If
- End Sub
- Private Sub btnCreateFile_Click(sender As Object, e As EventArgs) Handles btnCreateFile.Click
- 'These are the responses that will be shown depending on what keyword is identified in the user's answer
- 'They are all in a file called "Phone Keywords"
- FileOpen(1, filename, OpenMode.Append)
- WriteLine(1, "screen", "Cover any cracks if there are any and rub the screen with a cloth")
- WriteLine(1, "sound", "Consult a repair specialist. Until then, try using headphones")
- WriteLine(1, "internet", "Try contacting your internet service provider")
- WriteLine(1, "water", "Dry your phone off immediately and get any water out from the inside")
- WriteLine(1, "turn", "Charge it at the nearest power outlet")
- WriteLine(1, "respond", "Restart your phone and cool it down if it is overheating")
- WriteLine(1, "blank", "Leave your phone for a few hours and try again. If this does not work, contact a repair specialist")
- WriteLine(1, "dropped", "Cover any cracks in the screen and see a repair specialist")
- WriteLine(1, "service", "Try contacting your service provider")
- WriteLine(1, "bluetooth", "Turn off bluetooth and turn it on again. If this fails, then check the device it is connecting to")
- FileClose(1)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement