0
Reply

when I return to form2 the old form shows

George Sutfin

George Sutfin

Nov 10 2014 8:32 AM
616

when I return to form2 the old form shows

I am not sure where to start.
I have the following code in form2
Private reportTextBox(100, 20) As TextBox
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim Txtbox As TextBox
Dim rows As Integer = -1
Dim columns As Integer = -1
Dim a As Integer = 0
For y = 0 To 816 Step 24
rows += 1
columns = -1
For x = 0 To 558 Step 31
If x Mod 186 = 0 Then
Continue For
End If
columns += 1
Txtbox = New Windows.Forms.TextBox
Txtbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Txtbox.Location = New System.Drawing.Point(x, y)
Txtbox.Size = New System.Drawing.Size(30, 40)
Txtbox.Visible = True
Me.Controls.Add(Txtbox)
reportTextBox(rows, columns) = Txtbox
Next
Next
Label1.Text = Form1.seed.ToString
Label4.Text = Form1.shoehold.ToString
Label6.Text = Form1.GamesPlayed.ToString
For y = 0 To 12 Step 5
For x = 0 To 34
If Form1.report(a) < 0 Then
Form1.report(a) *= -1
For w = 0 To 4
reportTextBox(x, y + w).BackColor = Color.FromKnownColor(KnownColor.ControlLight)
Next
End If
reportTextBox(x, y).Text = Form1.report(a).ToString   *** HERE ***
a += 1
Next
Next
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim c, d, a As Integer
For y = 0 To 12 Step 5
For x = 0 To 34
If Form1.report(a) < 0 Then
Form1.report(a) *= -1
For w = 0 To 4
reportTextBox(x, y + w).BackColor = Color.FromKnownColor(KnownColor.ControlLight)
Next
End If
reportTextBox(x, y).Text = Form1.report(a).ToString   ***HERE ***
a += 1
Next
Next
Form1.test += 111
MsgBox(Form1.test.ToString)
reportTextBox(0, 0).Text = Form1.test.ToString
Me.Close()
End Sub
 

When I return to form2 the form1.report() is different than last time. SEE ** here ** in above code. But, the reportTextBox(x, y).text doesn't change. It is the same as before. What must be done to display updated form1.report()?
I have also tried using a public variable from form1.test in my sub button2 routine. The msbox shows that form1.test is being incremented, but the after the first occurrence the form2 doesn't change.
Thanks for your time and help
Completely lost George