Hello,
I am using some arrays that are pre-filled and I am having a random number generated between 0-10. That random number will then go in to all 5 arrays and pull the item from that location. I think try to take the sentence that is generated into another string. Once that is complete I then go through the final array to pull all the sentences and concatenate them together.
Currently I've only been able to get 1 sentence to print out of 5...a fresh pair of eyes would prob see where I am going wrong...I've been at this for awhile and wouldn't mind some advice to where I am going wrong.
Thanks in advance!
I am using some arrays that are pre-filled and I am having a random number generated between 0-10. That random number will then go in to all 5 arrays and pull the item from that location. I think try to take the sentence that is generated into another string. Once that is complete I then go through the final array to pull all the sentences and concatenate them together.
Currently I've only been able to get 1 sentence to print out of 5...a fresh pair of eyes would prob see where I am going wrong...I've been at this for awhile and wouldn't mind some advice to where I am going wrong.
Thanks in advance!
VB.NET:
Public Class MainForm
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btn_Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Clear.Click
txt_StoryBox.Text = ""
End Sub
Private Sub btn_Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Exit.Click
Me.Close()
End Sub
Private Sub btn_Show_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Show.Click
Dim finalSentence(5) As String
Dim nouns() As String = {"monkey", "pig", "senator", "lawyer", "doctor", "flower", "grapefruit", "ghost", "alien", "kumquat"}
Dim verbs() As String = {"walked", "complained", "jumped up and down", "slept", "juggled", "ate", "stomped laughed", "danced", "cried"}
Dim adverbs() As String = {"loudly", "softly", "gently", "wildly", "gingerly", "carefully", "angrily", "happily", "sadly"}
Dim adjectives() As String = {"obese", "skinny", "red-haired", "elderly", "purple", "prickly", "furry", "crooked", "reptillian", "childish"}
Dim connectors() As String = {"It all started when", "To everyon's surprise", "Then", "In spite of this", "Finally"}
For i As Integer = 0 To 5
Randomize()
Dim randomNumber As New Random
Dim rn As Integer
Dim holder As Integer = 0
rn = randomNumber.Next(0, 9)
finalSentence(holder) = connectors(rn) & " the " & adjectives(rn) & " " & nouns(rn) & " " & verbs(rn) & " " & adverbs(rn) & ". "
holder = holder + 1
Next i
For r As Integer = 0 To 5
Dim arrayLoc As Integer
txt_StoryBox.Text &= finalSentence(arrayLoc)
arrayLoc = arrayLoc + 1
Next r
End Sub
End Class