Here is a simple code that loops through all the controls on a Windows form and Appends the Array/List with the values
Sub GetTextBoxValues()
Dim arTextBoxVal() As String
Dim arTBCnt As Integer = 0
Dim ListTB As New List(Of String)
For Each ctlText In Me.Controls
If TypeOf ctlText Is TextBox Then
ReDim Preserve arTextBoxVal(arTBCnt)
arTextBoxVal(arTBCnt) = DirectCast(ctlText, TextBox).Text
ListTB.Add(DirectCast(ctlText, TextBox).Text)
arTBCnt += 1
End If
Next
End Sub
No comments:
Post a Comment