Iterate through property of a module or App

I have defined several property in the App and in the window.
I would like to write. method to re-set all values of those properties.
Instead of doing one by one, is there a way to iterate through the list of the properties?
(I am NOT referring to properties associated to a control [such as top, left, text etc…], I want to reset custom defined properties).

Thanks in advance.

I do not believe so…

Is this helpful? Change to add your window, your Control type and what you want to do with it.

For i As Integer = 0 To MainWindow.ControlCount - 1
  If (MainWindow.Control(i) IsA PushButton) Then
    PushButton(MainWindow.Control(i)).Height = PushButton(MainWindow.Control(i)).Height + 10
    PushButton(MainWindow.Control(i)).Top = PushButton(MainWindow.Control(i)).Top - 2 // just a little tweak
    PushButton(MainWindow.Control(i)).FontSize = 11
  End If
  If (MainWindow.Control(i) IsA PopupMenu) Then
    PopupMenu(MainWindow.Control(i)).Height = PopupMenu(MainWindow.Control(i)).Height + 10
    PopupMenu(MainWindow.Control(i)).Top = PopupMenu(MainWindow.Control(i)).Top - 2 // just a little tweak
    PopupMenu(MainWindow.Control(i)).FontSize = 11
  End If
  If (MainWindow.Control(i) IsA TextField) Then
    TextField(MainWindow.Control(i)).Height = TextField(MainWindow.Control(i)).Height + 10
    TextField(MainWindow.Control(i)).Top = TextField(MainWindow.Control(i)).Top - 2 // just a little tweak
    TextField(MainWindow.Control(i)).FontSize = 11
  End If

I don’t think so, especially if you want to differentiate the properties to reset and the others.
But you could consider putting all your properties in a class; then, your window/app class would have a single property (e.g. AllMyProperties As CMyProperties) containing all of them, which you could reset by a simple AllMyProperties=new CMyProperties).

1 Like

Thanks David, but I was not looking for a method to change object’s properties.

I will try to implement Arnaud_D suggestion.