السلام عليكم
مساء الخير
PHP كود :
Private Sub clearAllTextBoxes(ctl As Control)
If TypeOf ctl Is TextBox Then
CType(ctl, TextBox).Clear()
ElseIf ctl.HasChildren Then
For Each c As Control In ctl.Controls
If TypeOf c Is TextBox Then
CType(c, TextBox).Clear()
ElseIf c.HasChildren Then
For Each h As Control In c.Controls
If TypeOf h Is TextBox Then
CType(h, TextBox).Clear()
End If
Next
End If
Next
End If
End Sub
Private Sub fillAlltextBoxes(ctl As Control)
If TypeOf ctl Is TextBox Then
CType(ctl, TextBox).Text = ctl.Name
ElseIf ctl.HasChildren Then
For Each c As Control In ctl.Controls
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = c.Name
ElseIf c.HasChildren Then
For Each h As Control In c.Controls
If TypeOf h Is TextBox Then
CType(h, TextBox).Text = h.Name
End If
Next
End If
Next
End If
End Sub
كما ترون بالكود حلقات متداخلة فهل توجد طريقة تختصر هذه الاكواد؟
PHP كود :
Private Sub ClearTextBoxes(ByVal root As Control)
For Each ctrl As Control In root.Controls
ClearTextBoxes(ctrl)
If TypeOf ctrl Is TextBox Then
CType(ctrl, TextBox).Text = String.Empty
End If
Next ctrl
End Sub
Private Sub fill(ByVal root As Control)
For Each ctrl As Control In root.Controls
fill(ctrl)
If TypeOf ctrl Is TextBox Then
CType(ctrl, TextBox).Text = ctrl.Name
End If
Next ctrl
End Sub
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير


ربي زدني علما