in

vbCity Blogs

New (temp) place for vbCity Blogs

Mike McIntyre's .NET Journal

September 2008 - Posts

  • Use LINQ and Visual Basic 2008 to Get a List of TextBoxes from a Windows Forms Form

     

    Example:

      ' Create a LINQ query.

            Dim textBoxQuery = From control In Me.Controls Where TypeOf (control) Is TextField

            ' Create a list of object.

            Dim textBoxList = textBoxQuery.ToList

            ' Iterate through the objects in textBoxList.

            For Each txtBox As TextBox In testBoxList

                ' Show each TextBox's text property.

                MessageBox.Show(txtBox.Text)

            Next

Copyright 1998-2009 vbCity.com LLC
Powered by Community Server (Non-Commercial Edition), by Telligent Systems