|
-
Aug 2nd, 2004, 01:17 PM
#1
Thread Starter
Fanatic Member
VB6 code translation...
Hello, In VB6 I had a collection of textboxes which I could iterate through with For Each....
Control names were txtFactor .....and indexed like this..
txtFactor(0)
txtFactor(1)
txtFactor(2)
etc....
In VB6:
Dim txtTemp as textbox
For Each txtTemp In txtFactor
txtTemp.Enabled = False
Next txtTemp
which basically does this......in VB.NET after renaming the controls.
txtFactor0.Enabled = False
txtFactor1.Enabled = False
txtFactor1.Enabled = False
txtFactor2.Enabled = False
txtFactor3.Enabled = False
txtFactor4.Enabled = False
txtFactor5.Enabled = False
What VB.NET equivalent can I use?
-
Aug 2nd, 2004, 02:17 PM
#2
Thread Starter
Fanatic Member
Handled it like this.......
Private Sub DisableNumericUpDown(ByVal ctrlParent As Control)
Dim ctrl As Control
For Each ctrl In ctrlParent.Controls
If TypeOf ctrl Is NumericUpDown Then
ctrl.Enabled = False
End If
' If the control has children,
' recursively call this function
If ctrl.HasChildren Then
ctrl.Enabled = False
End If
Next
End Sub
This called it like this.....
Dim nupTemp As System.Windows.Forms.NumericUpDown
DisableNumericUpDown(nupTemp)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|