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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. VC++ .NET saveFileDialog

VC++ .NET saveFileDialog

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialcsharpc++question
4 Posts 2 Posters 0 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.
  • F Offline
    F Offline
    Freddie Code
    wrote on last edited by
    #1

    I want to get a file name back from the saveFileDialog box and store it as a global variable. What Type should I declare this varialbe as? Seems like the return type for the saveFileDialog file name is String and the compliler is not liking this Type.. Anyone have a simple VC++ .NET example on how to get the user selected file name back from the saveFileDialog box and stored in a variable? Thanks.

    A 1 Reply Last reply
    0
    • F Freddie Code

      I want to get a file name back from the saveFileDialog box and store it as a global variable. What Type should I declare this varialbe as? Seems like the return type for the saveFileDialog file name is String and the compliler is not liking this Type.. Anyone have a simple VC++ .NET example on how to get the user selected file name back from the saveFileDialog box and stored in a variable? Thanks.

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Here's what I have used: CString strFile; CFileDialog fSave(_parameters_); if ( fSave.DoModal() == IDOK ) { strFile = fSave.GetFileName(); }

      F 1 Reply Last reply
      0
      • A Anonymous

        Here's what I have used: CString strFile; CFileDialog fSave(_parameters_); if ( fSave.DoModal() == IDOK ) { strFile = fSave.GetFileName(); }

        F Offline
        F Offline
        Freddie Code
        wrote on last edited by
        #3

        For whatever reason, my .NET compiler is not liking the declaration of a variable as CString Type. I wonder if there needs to be included another .h file to be able to use String type? Compiler does not like this: CString myFileName;

        F 1 Reply Last reply
        0
        • F Freddie Code

          For whatever reason, my .NET compiler is not liking the declaration of a variable as CString Type. I wonder if there needs to be included another .h file to be able to use String type? Compiler does not like this: CString myFileName;

          F Offline
          F Offline
          Freddie Code
          wrote on last edited by
          #4

          I figured out what I was doing wrong. I did not realize that the return type of the file name is a pointer, so it needs to be declated like this. String *myFileName; :laugh::laugh::laugh:

          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