Reputation: 93
If in the label the default text is 10 then ten textbox controls will be generated in webform ...
Can anybody did this in VB.NET ?
Upvotes: 0
Views: 253
Reputation: 33143
Look at add control. You simply use a loop based on the counter in the label then you say myWebForm.Controls.Add(txtBox); where txtBox is:
Dim txtBox as TextBox
Sure here is some code:
Dim count as Integer
count = CType(Me.myLabel.Text, Integer)
For i as Integer=0 to count-1
txtBox = new TextBox()
txtBox.ID = "txt" & i.ToString()
myForm.Controls.Add(txtBox)
Next i
Upvotes: 2