enumerate the contols of a form

edited May 2013 in FastReport .NET
I want to access to several controls of a form in a function . You can do that in C# :
foreach( Control ctrl in this.Controls )
 {
 if ( ctrl.Name == name ) // Ou Tag.
 return ctrl;}
but in fastreport I have this error message :

"Impossible d'effectuer un cast d'un objet de type 'FastReport.Dialog.ButtonControl' en type 'System.Windows.Forms.Control'."

How can I do the same in fastreport

thank you

Comments

  • edited 1:48PM
    Did you ever figure this out? I am trying to do the same thing...
    oliv wrote: »
    I want to access to several controls of a form in a function . You can do that in C# :
    foreach( Control ctrl in this.Controls )
     {
     if ( ctrl.Name == name ) // Ou Tag.
     return ctrl;}
    
    but in fastreport I have this error message :

    "Impossible d'effectuer un cast d'un objet de type 'FastReport.Dialog.ButtonControl' en type 'System.Windows.Forms.Control'."

    How can I do the same in fastreport

    thank you
  • edited 1:48PM
    So I figured this out on my own.... here is the code to do this in VB
    for each o as object in Report.AllObjects
            if typeof(o) is TextObject then 
                 dim txt as TextObject = directcast(o,TextObject)
                 'Now do what you want with txt
            end if
    next
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.