Use other class member function in same namespace

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

    Use other class member function in same namespace

    Hi,

    I have 2 questions:

    How to call a class member function from another class and these 2 classes
    are in the same namespace?

    Also, how to use another project's dialog box and this 2 projects are in the
    same VS.NET solution?

    Thanks for any help,

    CT


  • Ignacio Machin

    #2
    Re: Use other class member function in same namespace

    Hi Chi,

    1: How to call a class member function from another class and these 2
    classes are in the same namespace?

    You can call a class's member if this member is declared as public static,
    if they are in the same namespace, then you do not have to include a "using"
    directive or fully quilify it. If the method is declared only as "public"
    then it's a method instance and you will need to call it using an instance
    of that class.

    2: Also, how to use another project's dialog box and this 2 projects are in
    the same VS.NET solution?

    Well that depend, the second project must be of type Class Library to be
    included in the first project, if the sboth projects are of type "Windows
    Project" , then AFAIK there is not way of doing so, at least directly in the
    IDE, you could use reflection to load the assembly and instantiate the class
    at runtime, but again, I do not know for sure that this is possible, I will
    search for it.
    Please provide more info regarding the projects types.

    Hope this help,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation


    "Chi Tang" <chikuotang@hot mail.com> wrote in message
    news:eD3qmHxRDH A.1688@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Hi,
    >
    > I have 2 questions:
    >
    > How to call a class member function from another class and these 2 classes
    > are in the same namespace?
    >
    > Also, how to use another project's dialog box and this 2 projects are in[/color]
    the[color=blue]
    > same VS.NET solution?
    >
    > Thanks for any help,
    >
    > CT
    >
    >[/color]


    Comment

    • Chi Tang

      #3
      Re: Use other class member function in same namespace

      Thanks for the reply. For the 2nd question boht projects are windows
      application so I think I should put some common function into a class
      library and used by both projects. I just try to use some dialog box
      resource (or forms) in both projects. Anyway, really appreciate all
      help...

      CT

      "Ignacio Machin" <ignacio.mach in AT dot.state.fl.us > wrote in message
      news:#xzyKcxRDH A.1572@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Hi Chi,
      >
      > 1: How to call a class member function from another class and these 2
      > classes are in the same namespace?
      >
      > You can call a class's member if this member is declared as public static,
      > if they are in the same namespace, then you do not have to include a[/color]
      "using"[color=blue]
      > directive or fully quilify it. If the method is declared only as "public"
      > then it's a method instance and you will need to call it using an instance
      > of that class.
      >
      > 2: Also, how to use another project's dialog box and this 2 projects are[/color]
      in[color=blue]
      > the same VS.NET solution?
      >
      > Well that depend, the second project must be of type Class Library to be
      > included in the first project, if the sboth projects are of type "Windows
      > Project" , then AFAIK there is not way of doing so, at least directly in[/color]
      the[color=blue]
      > IDE, you could use reflection to load the assembly and instantiate the[/color]
      class[color=blue]
      > at runtime, but again, I do not know for sure that this is possible, I[/color]
      will[color=blue]
      > search for it.
      > Please provide more info regarding the projects types.
      >
      > Hope this help,
      >
      > --
      > Ignacio Machin,
      > ignacio.machin AT dot.state.fl.us
      > Florida Department Of Transportation
      >
      >
      > "Chi Tang" <chikuotang@hot mail.com> wrote in message
      > news:eD3qmHxRDH A.1688@TK2MSFTN GP11.phx.gbl...[color=green]
      > > Hi,
      > >
      > > I have 2 questions:
      > >
      > > How to call a class member function from another class and these 2[/color][/color]
      classes[color=blue][color=green]
      > > are in the same namespace?
      > >
      > > Also, how to use another project's dialog box and this 2 projects are in[/color]
      > the[color=green]
      > > same VS.NET solution?
      > >
      > > Thanks for any help,
      > >
      > > CT
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...