Great thanks to you Danial

For other visitors who may need this code, here is the full code to iterate through the web form controls and getting the value of the found control. Other types of controls are also listed for you to test and print.



VB Code:
  1. Dim i As Integer
  2.         Dim x As string
  3.         Dim txt As String
  4.         Dim ct As Control
  5.         For i = 0 To MyForm.Controls.Count - 1
  6.             ct = MyForm.Controls(i)
  7.             x = ct.GetType.ToString
  8.             Select Case x
  9.                 Case "System.Web.UI.WebControls.TextBox"
  10.                       txt = CType(ct, TextBox).Text
  11.                       Response.Write("TextBox value is: " & txt)
  12.                 Case "System.Web.UI.WebControls.DropDownList"
  13.                       txt = CType(ct, DropDownList).SelectedItem.Text
  14.                       Response.Write("DropDownList value is: " & txt)
  15.                 Case "System.Web.UI.WebControls.ListBox"
  16.                       txt = CType(ct, ListBox).SelectedItem.Text
  17.                       Response.Write("ListBox value is: " & txt)
  18.                 Case "System.Web.UI.WebControls.Button"
  19.                       txt = CType(ct, Button).Text
  20.                       Response.Write("Button value is: " & txt)
  21.                 Case "System.Web.UI.WebControls.RadioButton"
  22.                 Case "System.Web.UI.WebControls.CheckBox"
  23.                 Case "System.Web.UI.HtmlControls.HtmlInputCheckBox"
  24.                 Case "System.Web.UI.HtmlControls.HtmlInputButton"
  25.             End Select
  26.         Next


MrAli