How to add a file to a usercontrol's resources

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

    #1

    How to add a file to a usercontrol's resources

    I want to include a help file with a usercontrol so that I can raise it with
    the control's context menu.


    I've been searching for how to do that and have concluded that the file can
    be added as a resource but can find only examples of how to add other
    things - usually strings.


    1. Is that really the way I should do it?

    2. Can you give of point to a sample code that adds a file to the resources?



    Thanks


  • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

    #2
    RE: How to add a file to a usercontrol's resources



    "Academia" wrote:
    I want to include a help file with a usercontrol so that I can raise it with
    the control's context menu.
    >
    >
    I've been searching for how to do that and have concluded that the file can
    be added as a resource but can find only examples of how to add other
    things - usually strings.
    >
    >
    1. Is that really the way I should do it?
    >
    2. Can you give of point to a sample code that adds a file to the resources?
    >
    >
    >
    Thanks
    >
    You can add a file as a resource and retrieve it with
    GetManifestReso urceStream. There is example code here:

    http://msdn2.microsoft.com/en-us/library/aa984367.aspx
    >
    >

    Comment

    • Academia

      #3
      Re: How to add a file to a usercontrol's resources

      I thought "How nice, so simple once you learn how".

      Then I realized that GetManifestReso urceStream returns a stream and
      Help.ShowHelp requires a file name!

      Do I need to actually copy the resource into a temp file.


      Thanks for the help.



      "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
      message news:A5EB40E1-1D67-47AC-A5B8-FCCFCF795FCC@mi crosoft.com...
      >
      You can add a file as a resource and retrieve it with
      GetManifestReso urceStream. There is example code here:
      >
      http://msdn2.microsoft.com/en-us/library/aa984367.aspx
      >
      >>
      >>

      Comment

      • Academia

        #4
        Re: How to add a file to a usercontrol's resources

        I copied it to a temp file and it works OK.
        Still wondering if all that is required.

        Thanks for pointing out that site.



        "Academia" <academiaNOSPAM @a-znet.comwrote in message
        news:uKt8gNPRIH A.2268@TK2MSFTN GP02.phx.gbl...
        >I thought "How nice, so simple once you learn how".
        >
        Then I realized that GetManifestReso urceStream returns a stream and
        Help.ShowHelp requires a file name!
        >
        Do I need to actually copy the resource into a temp file.
        >
        >
        Thanks for the help.
        >
        >
        >
        "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
        message news:A5EB40E1-1D67-47AC-A5B8-FCCFCF795FCC@mi crosoft.com...
        >>
        >You can add a file as a resource and retrieve it with
        >GetManifestRes ourceStream. There is example code here:
        >>
        >http://msdn2.microsoft.com/en-us/library/aa984367.aspx
        >>
        >>>
        >>>
        >
        >

        Comment

        • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

          #5
          Re: How to add a file to a usercontrol's resources

          If you really need a file, then it is probably simpler and faster just to
          package it with your application in an installer/deployment project. I did
          not realize passing a stream for the help was not an option or I would have
          pointed that out. Sorry!

          "Academia" wrote:
          I copied it to a temp file and it works OK.
          Still wondering if all that is required.
          >
          Thanks for pointing out that site.
          >
          >
          >
          "Academia" <academiaNOSPAM @a-znet.comwrote in message
          news:uKt8gNPRIH A.2268@TK2MSFTN GP02.phx.gbl...
          I thought "How nice, so simple once you learn how".

          Then I realized that GetManifestReso urceStream returns a stream and
          Help.ShowHelp requires a file name!

          Do I need to actually copy the resource into a temp file.


          Thanks for the help.



          "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
          message news:A5EB40E1-1D67-47AC-A5B8-FCCFCF795FCC@mi crosoft.com...
          >
          You can add a file as a resource and retrieve it with
          GetManifestReso urceStream. There is example code here:
          >
          http://msdn2.microsoft.com/en-us/library/aa984367.aspx
          >
          >>
          >>
          >
          >
          >

          Comment

          • Academia

            #6
            Re: How to add a file to a usercontrol's resources

            I like your suggestion to use GetManifestReso urceStream.
            Making a temp file and passing it works well.

            Thanks again

            "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
            message news:308B7B14-A9D5-4F02-8968-72AF68403509@mi crosoft.com...
            If you really need a file, then it is probably simpler and faster just to
            package it with your application in an installer/deployment project. I
            did
            not realize passing a stream for the help was not an option or I would
            have
            pointed that out. Sorry!
            >
            "Academia" wrote:
            >
            >I copied it to a temp file and it works OK.
            >Still wondering if all that is required.
            >>
            >Thanks for pointing out that site.
            >>
            >>
            >>
            >"Academia" <academiaNOSPAM @a-znet.comwrote in message
            >news:uKt8gNPRI HA.2268@TK2MSFT NGP02.phx.gbl.. .
            >I thought "How nice, so simple once you learn how".
            >
            Then I realized that GetManifestReso urceStream returns a stream and
            Help.ShowHelp requires a file name!
            >
            Do I need to actually copy the resource into a temp file.
            >
            >
            Thanks for the help.
            >
            >
            >
            "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
            message news:A5EB40E1-1D67-47AC-A5B8-FCCFCF795FCC@mi crosoft.com...
            >>
            >You can add a file as a resource and retrieve it with
            >GetManifestRes ourceStream. There is example code here:
            >>
            >http://msdn2.microsoft.com/en-us/library/aa984367.aspx
            >>
            >>>
            >>>
            >
            >
            >>
            >>
            >>

            Comment

            Working...