Showing posts with label GroupBox. Show all posts
Showing posts with label GroupBox. Show all posts

Monday, September 17, 2012

การเลือก Clear Control ที่เป็น Textbox ทั้งหมด ใน VB.Net

For Each ctrl As Control In Me.Controls
     If ctrl.GetType Is GetType(TextBox) Then        
         ctrl.Text = String.Empty
          ' Do something
      End If
Next



แต่มันจะข้ามที่อยู่ใน Groupbox
ถ้าเราจะให้ใน Groupbox ทำด้วยก็สั่งแบบนี้
For Each ctrl As Control In Groupbox1.Controls
     If ctrl.GetType Is GetType(TextBox) Then         
         ctrl.Text = String.Empty
          ' Do something 
      End If 
Next