WPF Call My own Methode

Hi!

I will call my own Methode in WPF...

Have anyone a short sample fro me?

  • You would call your own methods in the same manner that you would call any method in a .net framework class, using either the set statement if you are returning a value or the invoke statement if you are not.

    Take a look at the samples browser under Start menu-->All Programs-->Micro Focus Visual COBOL-->Samples and then select Windows Presentation Foundation in the left hand window and then one of the samples listed in the right hand side and open this up in Visual Studio.

    Also click on COBOL for .NET in the left window and select Core .NET for a sample that demonstrates using basic .NET functionality like callng methods, etc...

    Thanks

  • I have look there before but that is not what i Need!

    I need a own Methode under WPFand that will i invoke...

    So the documentation and samples are not helping there...

  • I have look there before but that is not what i Need!

    I need a own Methode under WPFand that will i invoke...

    So the documentation and samples are not helping there...

  • Hi,

    for any sample stuff on WPF, I usually search the web for samples in C#: The xaml part of those samples will fit for Visual COBOL. An example here is to get more events which will need a hook in XAML.

    Using Visual COBOL 2.1 upd 1 I had no problem so far in moving such C# into Visual COBOL, which makes it easier to mix legacy structures with the new stuff. This include things like datagrid and tabbed screens.

    Joachim Blome

  • like this in C#:

           ...

           ButtonOnOff();

           ...

           ...  

           public void ButtonOnOff()

           {

           }

  • Verified Answer

    This is covered in the docs under comparison of managed COBOL to C# here:

    You can add snippets to your code using the Ctrl K, Ctrl X keys.

    For method code use Ctrl K, Ctrl-X and then type met and select method-id and fill in the blanks.

    For your simple example with no parameters it would look like:

          invoke self::ButtonOnOff

    ...

    method-id. ButtonOnOff.
    procedure division.
       goback.
    end-method.

    For examples of passing parameters or returning parameters:

          01 mystring string.
          procedure division.
             
              set mystring to "test"
              invoke self::MyMethod(mystring)
              set mystring to self::MyMethod2
          end method.
          method-id MyMethod public.
          procedure division using mystring as string.

              set mystring to "Hello"
              goback.
          end method.

          method-id MyMethod2 public.
          procedure division returning mystring as string.

              set mystring to "Hello"
              goback.
          end method.