Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. attach a file to a windows form

attach a file to a windows form

Scheduled Pinned Locked Moved Managed C++/CLI
winformsquestion
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VonHagNDaz
    wrote on last edited by
    #1

    Hey Guys, I've done some Googling and some MSDN searches, but no luck. What I have is two Windows forms. I want to be able to attach a file/files from one of the forms, and then have the other form be able to see/open these attachments. Any ideas on which controls, data structures, or methods to use? I'm a bit stumped right now. I've investigated the FileDialog class, but I don't think that's what I need.

    [Insert Witty Sig Here]

    L 1 Reply Last reply
    0
    • V VonHagNDaz

      Hey Guys, I've done some Googling and some MSDN searches, but no luck. What I have is two Windows forms. I want to be able to attach a file/files from one of the forms, and then have the other form be able to see/open these attachments. Any ideas on which controls, data structures, or methods to use? I'm a bit stumped right now. I've investigated the FileDialog class, but I don't think that's what I need.

      [Insert Witty Sig Here]

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      1. The OpenFileDialog and SaveFileDialog let you interact with the user to determine which file he wants opened or saved, that is not what you want. 2. There is no universal control (or app) that can visualize any file you choose, unless in a very low-level form, such as a hex editor would do. So you will have to restrict the list of allowable file types, and/or use several controls, picking the one at run-time that corresponds to the current file type. 3. I have no idea what you mean by "attaching a file to a form". :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
      Please use <PRE> tags for code snippets, they improve readability.
      CP Vanity has been updated to V2.3

      V 1 Reply Last reply
      0
      • L Luc Pattyn

        1. The OpenFileDialog and SaveFileDialog let you interact with the user to determine which file he wants opened or saved, that is not what you want. 2. There is no universal control (or app) that can visualize any file you choose, unless in a very low-level form, such as a hex editor would do. So you will have to restrict the list of allowable file types, and/or use several controls, picking the one at run-time that corresponds to the current file type. 3. I have no idea what you mean by "attaching a file to a form". :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
        Please use <PRE> tags for code snippets, they improve readability.
        CP Vanity has been updated to V2.3

        V Offline
        V Offline
        VonHagNDaz
        wrote on last edited by
        #3

        Here is a scenario. Form1 is for the manager. From form1 he can enter a description of a project, assign a lead, and enter comments. With most projects, there are associated .doc, .pdf, or .xls files. By attach, I mean that the manager can add those files, similar to an email, so that the lead, from Form2 can see the files. I don't want the files to be viewable/opened from Form2, I'm looking for a way for the manager to add these files, and then have the project lead receive the files from Form2. Sorry if this is a confusing description, I do appreciate the help.

        [Insert Witty Sig Here]

        L 1 Reply Last reply
        0
        • V VonHagNDaz

          Here is a scenario. Form1 is for the manager. From form1 he can enter a description of a project, assign a lead, and enter comments. With most projects, there are associated .doc, .pdf, or .xls files. By attach, I mean that the manager can add those files, similar to an email, so that the lead, from Form2 can see the files. I don't want the files to be viewable/opened from Form2, I'm looking for a way for the manager to add these files, and then have the project lead receive the files from Form2. Sorry if this is a confusing description, I do appreciate the help.

          [Insert Witty Sig Here]

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          OK, so "Project" would be one of your classes; your manager would use a "ProjectEditForm" to view and alter a Project, he would have some means to add ("attach") relevant files to the Project (maybe through an OpenFileDialog indeed), and the list of attached files should be kept in a collection (maybe a List) and displayed somehow (maybe a ListBox or a TreeView). The lead does not get the files from the manager's form, he should have his view on the same Project, maybe through a "ProjectViewForm" which could be similar to a "ProjectEditForm" with fewer privileges (and maybe also more details). In my view you want to persist a Project somehow, maybe in an XML file, maybe in a database. Conclusion: it is not form-communicates-to-other-form, it is an object-needing-persistence-and-multiple-views. :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
          Please use <PRE> tags for code snippets, they improve readability.
          CP Vanity has been updated to V2.3

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups