Referencing a Windows Application Form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bisley

    Referencing a Windows Application Form

    I wish to reference call a method contained in my Windows Applications
    "main" form, from another class in the same namespace.

    Can anyone tell em how to do this please?

    TIA

    Bisley


  • Shardool Karnik

    #2
    Re: Referencing a Windows Application Form

    You can pass a reference of the main form to the other class ...

    - Shardool

    "Bisley" <x> wrote in message news:eiKUF177DH A.2760@TK2MSFTN GP09.phx.gbl...[color=blue]
    > I wish to reference call a method contained in my Windows Applications
    > "main" form, from another class in the same namespace.
    >
    > Can anyone tell em how to do this please?
    >
    > TIA
    >
    > Bisley
    >
    >[/color]


    Comment

    • Karl Meissner

      #3
      Re: Referencing a Windows Application Form

      "Bisley" <x> wrote in message news:<eiKUF177D HA.2760@TK2MSFT NGP09.phx.gbl>. ..[color=blue]
      > I wish to reference call a method contained in my Windows Applications
      > "main" form, from another class in the same namespace.
      >
      > Can anyone tell em how to do this please?
      >
      > TIA
      >
      > Bisley[/color]

      What do you mean by "to reference call a method "

      If you just want to call a method (with no object) in another class,
      the method can be public and static. Then it can be called from
      anywhere in the app. If you want the methd to only be visiable to
      the namespace make it internal rather then public.

      For example

      namespace xyz {

      public class MyClass {

      static public void dosomething() {
      //....can only access other static fields here
      }
      }

      public class user {

      void update() {

      MyClass.dosomet hing(); // no ojbect needed
      }
      }



      Karl Meissner, Software Consulant,

      Comment

      Working...