On Mon, 30 Sep 2013, Bruce wrote: > Aaaaarrrgghhh! I've done this a zillion times before but today I can't > find an example. > > > How do I get the type of the Application.CurrentControl control? > > It's not TypeOf() as that returns gb.Object > I need to know if it has a text or value so I can copy it to the > clipboard, >
To get the type (class name) of an object (you were so close :-)): Object.Type(Application.CurrentControl) but you could also directly check for a Text or Value property: Dim hClass As Class = Object.Class(Application.CurrentControl) If hClass.Exist("Text") And If hClass["Text"].Kind = Class.Property Then HasText() Else If hClass.Exist("Value") And If hClass["Value"].Kind = Class.Property Then HasValue() Endif or probably a bit faster but a little ugly: Dim vValue As Variant Try vValue = Application.CurrentControl.Value If Not Error Goto _Found Try vValue = Application.CurrentControl.Text If Not Error Goto _Found NothingToCopy() Return _Found: CopyToClipboard() Regards, Tobi ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user