On Mar 27, 2007, at 1:28 PM, Markus Winter wrote:

> Hi all,
>
> probaby a dumb question but it doesn't hurt to ask ;-)
>
> I wanted to write a generic method to set the properties (like  
> TextFont,
> TextSize, etc) of EditFields, StaticTexts, and Listboxes. I tried the
> following:
>
> Function SetControlProperties (ControlType as control,  
> ControlProperty as
> string, FontOrSize as string)
>
>   dim i as integer
>
>   if FontOrSize = "Font" then
>
>     For i = 0 to Self.ControlCount-1  //number of controls in window
>       If Self.control(i) IsA ControlType then
>         ControlType(control(i)).TextFont = ControlProperty
>       end if
>     next
>
>   else // set the size
>
>     For i = 0 to Self.ControlCount-1  //number of controls in window
>       If Self.control(i) IsA ControlType then
>         ControlType(control(i)).Text = ControlProperty
>       end if
>     next
>
>   end if
>
> but funnily enough it isn't working (I get a "There is no class  
> with this
> name" error).
>
> Any way around this or do I have to do this separate for each type of
> control?

There's no class called "ControlType" so lines like
        ControlType(control(i)).TextFont = ControlProperty
wont compile

a cast requires a type and ControlType is not one


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to