VB.NET change number in 2D Array with "Nothing"

  • Thread starter Thread starter Jonathan.12
  • Start date Start date
J

Jonathan.12

Guest
Hello,

At the moment I'm building a number generator program in VB.NET.

I have a 2D array (with two rows and five columns) with 10 numbers in a textbox (Array.Text):

Row 1: 4, 7, 8, 2, 1

Row 2: 3, 9, 5, 7, 10

A number generator is guessing if the generated number is in the textbox (Array.Text). If the number is in the textbox (Array.Text). I want that the matching number will be erased in my textbox.

My code:

Generator = Random.Next(0, 100)

If Array.Text.Contains(Generator) Then
Array.Text = Array.Text.Replace(Generator, Nothing & ",")
End If

The number is replaced with a empty line, but my lay-out is messy after the replacement. For example when number 4 is generated:

Row 1:, 7, 8, 2, 1

Row 2: 3, 9, 5, 7, 10

My question: Is it possible to maintain the original lay-out after a replacement?

Thanks in advance.

Continue reading...
 
Back
Top