1

I would expect this code when run to output the first line of the array, pause, then output the second line in the array, each line being output with a delay between each character but for some reason it isn't working for me.

        Dim IntroText(4) As String
    IntroText(0) = "Konrad Czajkowski..."
    IntroText(1) = "...Presents"
    IntroText(2) = "...A text based game..."
    IntroText(3) = "...The Legend of Konrad and The Quest for Skairum"

    Dim IntroTextLength As Integer = Nothing
    IntroTextLength = IntroText(IntroText.Length - 1)

    For IntroCounter1 = 0 To IntroTextLength
        For IntroCounter2 = 0 To IntroText(IntroCounter1).Length - 1
            Console.Write(IntroText(IntroTextLength)(IntroCounter2))
            Threading.Thread.Sleep(50)
        Next
        Threading.Thread.Sleep(5000)
        Console.Clear()
    Next
    Console.Clear()

P.s I'm using a console application in VB.NET

1 Answer 1

1

Try this.

Dim IntroText(4) As String
IntroText(0) = "Konrad Czajkowski..."
IntroText(1) = "...Presents"
IntroText(2) = "...A text based game..."
IntroText(3) = "...The Legend of Konrad and The Quest for Skairum"

Dim IntroTextLength As Integer = Nothing
IntroTextLength = IntroText.Length - 1

For IntroCounter1 = 0 To IntroTextLength - 1
    For IntroCounter2 = 0 To IntroText(IntroCounter1).Length - 1
        Console.Write(IntroText(IntroCounter1)(IntroCounter2))
        'Console.Write(IntroTextLength)
        Threading.Thread.Sleep(50)
    Next
    Threading.Thread.Sleep(500)
    Console.Clear()
Next
Console.Clear()
Sign up to request clarification or add additional context in comments.

3 Comments

It worked! Thank you, couldn't fix it myself, practicing vb for later in life, I'm in college and this is very valuable feedback. Thanks!
It's good that this fixed the OPs problem but it would be worth explaining why.
Code only answers are discouraged. You should at least try to explain why the OP code was incorrect and what your code does to fix the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.