Sunday 22 September 2013

How to get the list of all the controls in a form in Visual Basic 6.0

'This program will retrieve all the controls in the form and the name of the controls and their type in a list box.

option explicit
private ctl as object

private sub Form_Load()
   for each ctl in Me.Controls
      ' this listbox will contain name and types of all the controls including itself.
       list1.Additem ctl.Name & "," & vba.typename(ctl)
       doevents
   next ctl   
End Sub

No comments: