2

The VBA documentation suggests that BoundValue is a valid Control property for a MultiPage control, but doesn't mention whether it is valid for a TabStrip control.

When I try to use Debug.Print Me.MultiPage1.BoundValue or Debug.Print Me.TabStrip1.BoundValue (even if I explicitly set the focus to the control first), then VBA throws error 450 - Wrong number of arguments or invalid property assignment. That suggests that I'm calling the member incorrectly, or there's some contextual requirement for it to return. But I can't seem to find any state in which the property is readable.

Is the documentation incorrect (shock, horror!!!)? Is it possible to read the BoundValue property of a MultiPage or TabStrip? Are there any special conditions for it being readable?

ThunderFrame
  • 9,352
  • 2
  • 29
  • 60
  • Could the property be indexed and you need to specify a tab index to read it? – Mathieu Guindon Mar 22 '17 at 22:25
  • @Mat'sMug yep - turns out `BoundValue` returns a collection for these controls, and an index is required. – ThunderFrame Mar 23 '17 at 00:53
  • The `BoundValue` member is a member of `IControl` that is extended to each control, but while the `BoundValue` return type is `Variant`, the returned type varies by the control being accessed, so unless Rubberduck is inspecting a *Variable* of explicit type Control, it doesn't (currently) know that `BoundControl` is an available property. If it is inspecting a variable explicitly declared as type `Control`, it only knows that `BoundObject` returns a `Variant`. – ThunderFrame Mar 23 '17 at 03:37

1 Answers1

1

Huh, I assigned Me.MultiPage and Me.TabStrip1 to variables of type Control and inspected the BoundValue in the Locals window.

The MultiPage BoundValue property returns the complete Pages collection, and the TabStrip BoundValue property returns the complete Tabs collection. For a MultiPage control, that's at odds with the documentation, and while the control's Value property returns a Long signifying the currently selected Page, having BoundValue return the complete Pages collection doesn't really tell me anything useful.

I guess I now know that BoundValue does return something, but I don't know if what it returns is useful.

ThunderFrame
  • 9,352
  • 2
  • 29
  • 60