• 0

VB Loops And Arrays


Question

I'm writing a little sub procedure that takes an 2d array, and adds a string to it exactly three times (in a random position). Every time I run this code, I end up with an infinite loop.

Note: The array is dimmed 1 to 5, 1 to 5 (25 total), hence the Random Statements are only from 1 to 5.

<pre>

Sub GenerateArray(ByRef strArray() As String, ByVal strGameType As String)

Dim intCounter As Integer, intRows As Integer, intColumns As Integer, intRandom As Integer

Randomize

intRows = Int((5) * Rnd - 1)

intColumns = Int((5) * Rnd - 1)

intCounter = 0

Do Until intCounter = 3

    If strArray(intRows, intColumns) = "" Then

    strArray(intRows, intColumns) = strGameType

    intCounter = intCounter + 1

    Else

    intCounter = intCounter

    End If

Loop

End Sub

</pre>

Anyone happen to see any errors?

Link to comment
https://www.neowin.net/forum/topic/21211-vb-loops-and-arrays/
Share on other sites

6 answers to this question

Recommended Posts

  • 0

yeah

everything after DO til Loop happens over and over again

so whats before DO doesnt really apply

unless you're applying a setting or something

ex:

Do:

blah = blah + 1

Loop until blah = 3

that would work because blah is w/in the do and loop

make any sense?

but if it were like

blah

Do until blah = 3

yada yada

Loop

its like ok....im doing what until blah = 3

because blah is before the do

lol

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Looks interesting, I love the art style. How many people are working on the game?
    • AMD releases driver 25.8.1 with support for new RX 9060, new games, and more by Taras Buria AMD has a new driver for customers with Radeon graphics cards. Version 25.8.1 WHQL is now available with optimizations for more games and support for the new RX 9060 non-XT graphics card. The update also has plenty of fixed issues and bugs. Here are the update highlights: New Game Support New Game Support for FSR 4 Mafia: The Old Country Mecha BREAK WUCHANG: Fallen Feathers Valorant (Unreal Engine 5 release) Battlefield 6 Open Beta The Alters F1 25 Cyberpunk 2077 WUCHANG: Fallen Feathers Mafia: The Old Country Arena Breakout: Infinite Game of Thrones: Kingsroad Wreckfest 2 Lies of P Fixed issues and bugs include the following: Stutter and lower than expected performance may be observed while playing 4K resolution YouTube videos in Chrome. Intermittent application crash or driver timeout may be observed while playing Monster Hunter Wilds with Radeon Anti-Lag and Instant Replay enabled. Intermittent application crash may be observed while playing Battlefield 2042. Intermittent application crash may be observed while playing Dragon Age: The Veilguard on Radeon RX 9000 series graphics products. Stutter improved while playing Call of Duty: Warzone Season 03 ‘Verdansk’ map on some AMD Graphics Products NOTE: Stutter has been reduced with 25.8.1, and AMD is working with the developer toward a full solution. Texture issues may be observed while using Oculus Rift S on RX 5000 and 6000 series graphics products. And here is the list of known bugs: Corruption may appear while playing Mafia: The Old Country on Radeon RX 6600 series graphics products. Intermittent application crash may be observed while playing The Last of Us Part II on Radeon RX 7900 series graphics products. Intermittent application crash may be observed while playing Call of Duty: Black Ops 6 on Radeon RX 9000 series graphics products. Intermittent application crash or driver timeout may be observed while playing Wuchang: Fallen Feathers with FSR 4 enabled on Radeon™ RX 9000 series graphics products. Intermittent application crash may be observed while playing FBC: Firebreak on some AMD Ryzen processors such as the Ryzen AI 300 series and the Ryzen 7000 series. Intermittent application crash may be observed while playing NBA 2K26 in MyCareer mode on Radeon RX 9070 series graphics products. AMD Radeon Software 25.8.1 is available on 64-bit Windows 10 and 11 systems with supported Radeon graphics cards. You can download it from the official support website. Full release details are available on the same page.
    • Fair shout! But the best way to get this on our news side would be to have Pulasti @LoneWolfSLhave a crack at Early Access when its in a playable state  
    • Interesting. Seems to promote or invite more people to use whatsapp.
    • AI is going to destroy online as well as offline worlds.
  • Recent Achievements

    • First Post
      Aidan Helfrich earned a badge
      First Post
    • Collaborator
      bullgod69 earned a badge
      Collaborator
    • Enthusiast
      Ed B went up a rank
      Enthusiast
    • Reacting Well
      Xinotema earned a badge
      Reacting Well
    • Dedicated
      Edward266 earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      763
    2. 2
      ATLien_0
      187
    3. 3
      +FloatingFatMan
      151
    4. 4
      Xenon
      118
    5. 5
      wakjak
      113
  • Tell a friend

    Love Neowin? Tell a friend!