I'm new in .NET programming.
I have a class Form1 that includes Button1_Click event. (Button1_Click creates a multiple Text Boxies at run time)
Here is the class:
Public Class Form1
Dim shiftDown As Integer
Dim counter As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim textbox1 As New TextBox
counter += 1
shiftDown = shiftDown + 30
textbox1.Name = "Textbox" + counter.ToString()
textbox1.Size = New Size(170, 10)
textbox1.Location = New Point(10, 32 + shiftDown)
textbox1.Visible = True
GroupBox1.Controls.Add(textbox1)
End Sub
End Class
Currently this rows:
Dim shiftDown As Integer
Dim counter As Integer
defined as global variables.
My question is, instead of the way they are, should I define these variables as properties or as static local variables in Button1_Click event?