Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: How to convert C# function to Visual Cobol for .NET

$
0
0

Thank you for your help. Your example works to forms without containers and in this post I forgot to specify this. I got as follows, do not know if it's the best way, but it works.

method-id tsBtnLimpa_Click final private.

procedure division using by value sender as object e as type System.EventArgs.

   invoke limpaCampos()

end method.

method-id. limpaCampos public.

    *> le os controles dentro do (container) panel principal        

    perform varying myobj as type Control thru self::panel::Controls

         *> limpa os textboxs dentro do panel principal

         if myobj instance of type TextBox

            declare tb as type TextBox = myobj as type TextBox

            set tb::Text to string::Empty

         end-if  

         *> limpa o checkBox dentro do panel principal

         if myobj instance of type CheckBox

            declare tb as type CheckBox = myobj as type CheckBox

            set tb::Checked to false

         end-if            

         *> limpa o maskedTextBox dentro do panel principal

         if myobj instance of type MaskedTextBox

            declare tb as type MaskedTextBox = myobj as type MaskedTextBox

            set tb::Text to string::Empty

         end-if          

         if myobj instance of type GroupBox

            *> limpa os controles dentro dos containers GroupBoxs

            perform varying ctrl as type Control thru myobj as type GroupBox::Controls

                   *> limpa textboxs

                   if ctrl instance of type TextBox

                      declare tb as type TextBox = ctrl as type TextBox

                      set tb::Text to string::Empty

                   end-if

                   *> limpa maskedTextBoxs

                   if ctrl instance of type MaskedTextBox

                      declare tb as type MaskedTextBox = ctrl as type MaskedTextBox

                      set tb::Text to string::Empty

                   end-if  

            end-perform

         end-if  

    end-perform

end method.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>