2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by cguan_77
0
'used stuffs :- list1 and its two arrays(0,1)

'displaying name along with its index of the selected control
Private Sub List1_Click(Index As Integer)
MsgBox List1(Index).Name & "(" & Index & ")"
End Sub

'dynamically adding items to all listboxes present on the current form
Private Sub Form_Load()
Dim ctlControl As Object
    On Error Resume Next
    For Each ctlControl In Me.Controls
        If TypeOf ctlControl Is ListBox Then
        ctlControl.AddItem "computer"
        DoEvents
        End If
    Next ctlControl
End Sub
0

'used stuffs :- list1 and its two arrays(0,1)

'displaying name along with its index of the selected control
Private Sub List1_Click(Index As Integer)
MsgBox List1(Index).Name & "(" & Index & ")"
End Sub

'dynamically adding items to all listboxes present on the current form
Private Sub Form_Load()
Dim ctlControl As Object
On Error Resume Next
For Each ctlControl In Me.Controls
If TypeOf ctlControl Is ListBox Then
ctlControl.AddItem "computer"
DoEvents
End If
Next ctlControl
End Sub

thanks choudhuryshouvi it really works..thank you so much

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.