Hi,
I have been searching for a few days now for a solution to my problem. Please excuse any programming faux pas as I am very new to programming.
I have created a textbox array based on the number of 'Channels' on another form. This number dictates how many textboxes (and other controls) to add to my new form.
I expect the user to type in their 'type' of channel into each textbox.
The thing I am having problems with is once the user types in the information, how do I access the data and store it for a future form?
Here is my code (once again excuse my programming skills):
Public Class Fixture1Setting
Dim labels As New List(Of Label)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.Timer1.Enabled = True
Form1.Show()
Form1.BringToFront()
Me.Hide()
End Sub
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Form1.Show()
Form1.BringToFront()
End Sub
Private Sub Fixture1Setting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = Form1.FixLabel1.Text
Dim alabel As Label
Dim tboxtype As TextBox
Dim tboxfrom As TextBox
Dim tboxto As TextBox
Dim chkboxyes As CheckBox
' Create Label Array
For i As Byte = 1 To Val(Form1.ChannelTextBox1.Text) ' ChannelTextBox1 = Number of Channels
alabel = New Label
With alabel
.Parent = Me
.Left = 0
.Height = 13
.Width = 100
.Top = .Height * i + 50
.Visible = True
.Tag = i
.Text = "Channel Settings:"
.Name = "label_" & i
.Location = New Point(12, 40 + (i * 30))
End With
labels.Add(alabel)
Next
'Create TextboxType Array
For i As Byte = 1 To Val(Form1.ChannelTextBox1.Text) ' ChannelTextBox1 = Number of Channels
tboxtype = New TextBox
With tboxtype
.Parent = Me
.Left = 0
.Height = 13
.Width = 80
.Top = .Height * i + 50
.Visible = True
.Tag = i
.Text = ""
.Name = "textboxtype_" & i
.Location = New Point(120, 40 + (i * 30))
Form1.Label1.Text = tboxtype.Text
End With
Next
'Create TextBoxFrom Array
For i As Byte = 1 To Val(Form1.ChannelTextBox1.Text) ' ChannelTextBox1 = Number of Channels
tboxfrom = New TextBox
With tboxfrom
.Parent = Me
.Left = 0
.Height = 13
.Width = 30
.Top = .Height * i + 50
.Visible = True
.Tag = i
.Text = "1"
.Name = "textboxfrom_" & i
.Location = New Point(211, 40 + (i * 30))
End With
Next
'Create TextBoxTo Array
For i As Byte = 1 To Val(Form1.ChannelTextBox1.Text) ' ChannelTextBox1 = Number of Channels
tboxto = New TextBox
With tboxto
.Parent = Me
.Left = 0
.Height = 13
.Width = 30
.Top = .Height * i + 50
.Visible = True
.Tag = i
.Text = "255"
.Name = "textboxto_" & i
.Location = New Point(262, 40 + (i * 30))
End With
Next
'Create CheckBoxYes Atrray
For i As Byte = 1 To Val(Form1.ChannelTextBox1.Text) ' ChannelTextBox1 = Number of Channels
chkboxyes = New CheckBox
With chkboxyes
.Parent = Me
.Left = 0
.Height = 13
.Width = 20
.Top = .Height * i + 50
.Visible = True
.Tag = i
.Name = " chkboxyes_" & i
.Checked = True
.Location = New Point(323, 40 + (i * 30))
End With
Next
End Sub
End Class
I have added an image of the form iof this helps.
I thank you in advance and look farward to any replies.
Gotang