teampowers
New member
- Joined
- Aug 3, 2007
- Messages
- 2
- Programming Experience
- 5-10
Hi,
I am new the forum and I need some help. I am creating a series of controls based on a drop down list. I have included the code of how I create the dynamic controls.
The problem is that I cannot figure out how to get the values of the dynamically created controls when I have a button click event. I have tried everything and I still cannot get the values.
Any help that you can provide would be appreciated and if you have a better way to create these, please let me know.
Thanks in Advance!
I am new the forum and I need some help. I am creating a series of controls based on a drop down list. I have included the code of how I create the dynamic controls.
The problem is that I cannot figure out how to get the values of the dynamically created controls when I have a button click event. I have tried everything and I still cannot get the values.
Any help that you can provide would be appreciated and if you have a better way to create these, please let me know.
VB.NET:
Dim n As Integer
n = Me.SessionNumber.Value
'Declare the Variables
Dim i As Integer
Dim Label As Label
Dim Label2(n) As Label
Dim Location As TextEdit
Dim Location2(n) As TextEdit
Dim StartDate As DateEdit
Dim StartDate2(n) As DateEdit
Dim EndDate As DateEdit
Dim EndDate2(n) As DateEdit
Dim CallDate As DateEdit
Dim CallDate2(n) As DateEdit
For i = 1 To n
Label = New Label
Location = New TextEdit
StartDate = New DateEdit
EndDate = New DateEdit
CallDate = New DateEdit
Label.Parent = Panel2
Location.Parent = Panel2
StartDate.Parent = Panel2
EndDate.Parent = Panel2
CallDate.Parent = Panel2
Label.Text = "Session #" + CType(i, String)
Dim topvalue As Integer
topvalue = CType((i - 1) * 30, Integer)
Label.Width = CType(100, Integer)
Label.Top = topvalue
Location.Top = topvalue
StartDate.Top = topvalue
EndDate.Top = topvalue
CallDate.Top = topvalue
Location.Left = CType(110, Integer)
StartDate.Left = CType(250, Integer)
EndDate.Left = CType(390, Integer)
CallDate.Left = CType(530, Integer)
Location.Visible = True
Label.Visible = True
StartDate.Visible = True
EndDate.Visible = True
CallDate.Visible = True
Label2(i) = Label
Location2(i) = Location
StartDate2(i) = StartDate
EndDate2(i) = EndDate
CallDate2(i) = CallDate
Next i
Thanks in Advance!