Windows Forms Application

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

    Windows Forms Application

    How do I make a dataset available to all forms (including dialogs) in a
    Windows Form based application?

    Thanks,
    eXtreme


  • AlexS

    #2
    Re: Windows Forms Application

    Make it public and visible in all classes

    HTH
    Alex
    "eXtreme" <eXtreme@commun ity.nospam> wrote in message
    news:%23qqxaxRa FHA.3184@TK2MSF TNGP15.phx.gbl. ..[color=blue]
    > How do I make a dataset available to all forms (including dialogs) in a
    > Windows Form based application?
    >
    > Thanks,
    > eXtreme
    >
    >[/color]


    Comment

    • eXtreme

      #3
      Re: Windows Forms Application

      I made the object Public and form it is on Public but a dialog spun from
      that Form is not able to see it.

      Where do I check the visibility?

      Thanks,


      "AlexS" <salexru2000NO@ SPAMsympaticoPL EASE.ca> wrote in message
      news:uH401zRaFH A.2420@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Make it public and visible in all classes
      >
      > HTH
      > Alex
      > "eXtreme" <eXtreme@commun ity.nospam> wrote in message
      > news:%23qqxaxRa FHA.3184@TK2MSF TNGP15.phx.gbl. ..[color=green]
      >> How do I make a dataset available to all forms (including dialogs) in a
      >> Windows Form based application?
      >>
      >> Thanks,
      >> eXtreme
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Nick Malik [Microsoft]

        #4
        Re: Windows Forms Application

        You can either pass a reference to the form to the child form, so that it
        can refer to the public members.

        Alternative: you can provide a static method on the form that will return
        the object. You do not need a reference to the object in the calling code
        to call the static method. You can just use the name of the class. This is
        a Singleton.

        Take a look at http://www.pobox.com/~skeet/csharp/singleton.html


        --
        --- Nick Malik [Microsoft]
        MCSD, CFPS, Certified Scrummaster


        Disclaimer: Opinions expressed in this forum are my own, and not
        representative of my employer.
        I do not answer questions on behalf of my employer. I'm just a
        programmer helping programmers.
        --
        "eXtreme" <eXtreme@commun ity.nospam> wrote in message
        news:ueizo7RaFH A.3032@TK2MSFTN GP10.phx.gbl...[color=blue]
        >I made the object Public and form it is on Public but a dialog spun from
        >that Form is not able to see it.
        >
        > Where do I check the visibility?
        >
        > Thanks,
        >
        >
        > "AlexS" <salexru2000NO@ SPAMsympaticoPL EASE.ca> wrote in message
        > news:uH401zRaFH A.2420@TK2MSFTN GP12.phx.gbl...[color=green]
        >> Make it public and visible in all classes
        >>
        >> HTH
        >> Alex
        >> "eXtreme" <eXtreme@commun ity.nospam> wrote in message
        >> news:%23qqxaxRa FHA.3184@TK2MSF TNGP15.phx.gbl. ..[color=darkred]
        >>> How do I make a dataset available to all forms (including dialogs) in a
        >>> Windows Form based application?
        >>>
        >>> Thanks,
        >>> eXtreme
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • eXtreme

          #5
          Re: Windows Forms Application

          What's the best book I can buy, which is C# based, and would teach me about
          Windows Forms and how to reference objects not in the current form?

          Thanks,
          eXtreme

          "Nick Malik [Microsoft]" <nickmalik@hotm ail.nospam.com> wrote in message
          news:YfidnWVcCd _QSTzfRVn-3g@comcast.com. ..[color=blue]
          > You can either pass a reference to the form to the child form, so that it
          > can refer to the public members.
          >
          > Alternative: you can provide a static method on the form that will return
          > the object. You do not need a reference to the object in the calling code
          > to call the static method. You can just use the name of the class. This
          > is a Singleton.
          >
          > Take a look at http://www.pobox.com/~skeet/csharp/singleton.html
          >
          >
          > --
          > --- Nick Malik [Microsoft]
          > MCSD, CFPS, Certified Scrummaster
          > http://blogs.msdn.com/nickmalik
          >
          > Disclaimer: Opinions expressed in this forum are my own, and not
          > representative of my employer.
          > I do not answer questions on behalf of my employer. I'm just a
          > programmer helping programmers.
          > --
          > "eXtreme" <eXtreme@commun ity.nospam> wrote in message
          > news:ueizo7RaFH A.3032@TK2MSFTN GP10.phx.gbl...[color=green]
          >>I made the object Public and form it is on Public but a dialog spun from
          >>that Form is not able to see it.
          >>
          >> Where do I check the visibility?
          >>
          >> Thanks,
          >>
          >>
          >> "AlexS" <salexru2000NO@ SPAMsympaticoPL EASE.ca> wrote in message
          >> news:uH401zRaFH A.2420@TK2MSFTN GP12.phx.gbl...[color=darkred]
          >>> Make it public and visible in all classes
          >>>
          >>> HTH
          >>> Alex
          >>> "eXtreme" <eXtreme@commun ity.nospam> wrote in message
          >>> news:%23qqxaxRa FHA.3184@TK2MSF TNGP15.phx.gbl. ..
          >>>> How do I make a dataset available to all forms (including dialogs) in a
          >>>> Windows Form based application?
          >>>>
          >>>> Thanks,
          >>>> eXtreme
          >>>>
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • Steven Cheng[MSFT]

            #6
            Re: Windows Forms Application

            Hi eXtreme,

            For winform books, I'd recommend Chris Cells's

            #Windows Forms Programming in C#

            ?v=glance

            Also, there're many good tech articles in MSDN

            #Windows Forms Programming in C#
            Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.

            me=true

            In addition, as for the
            ===============
            how to reference objects not in the current form?
            ===============
            you mentioned, I think it depends on the objects/data's role and
            functionality in your app. Is it usefule and accessiable from all the forms
            in your app? If it's a global data, I think you can consider Nick 's
            suggestion on using a singleton class which hold the goblal object
            references so that we can Access those objects/datas from any form or
            class's code. Since your scenario is winform(clients ide app) , we don't
            need to worry too much about cocurrecy issues.

            Thanks,

            Steven Cheng
            Microsoft Online Support

            Get Secure! www.microsoft.com/security
            (This posting is provided "AS IS", with no warranties, and confers no
            rights.)


            Comment

            Working...