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. C#
  4. Save

Save

Scheduled Pinned Locked Moved C#
csharpquestion
5 Posts 3 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.
  • W Offline
    W Offline
    WartHog000
    wrote on last edited by
    #1

    Say if you make a program that alows the user to "save a phone number, or Save a file". How do you save then load the file in the program? And create a directory and access it for the saved items? I just got into c# when the summer started. So Thanks. WartHog

    H 1 Reply Last reply
    0
    • W WartHog000

      Say if you make a program that alows the user to "save a phone number, or Save a file". How do you save then load the file in the program? And create a directory and access it for the saved items? I just got into c# when the summer started. So Thanks. WartHog

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      There is no standard way - this is what programs do. You must decide the saving and loading routines. If you want to write a text file, you can use a TextWriter derivative, like StreamWriter or simply use File.CreateText. When you read it, use a TextReader or simply File.ReadText (which returns a TextReader, an abstract class for other classes like StreamReader. If you want to write binary files, you can use FileStream to both read and write. If you want to store these attributes (like the phone number) in an object and serialize that to XML (a text format), then use XmlSerializer defined in the System.Xml namespace. There's really a seemingly infinite ways of accomplishing this task and it all depends on what you want to do. This is a basic concept, however. I recommend that you read the .NET Framework SDK - especially the programming topics - and pick up a book or two on developing applications with .NET. If you read the .NET Framework SDK - and you should - the class documentation for those classes I mentioned above even have examples. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

      W 1 Reply Last reply
      0
      • H Heath Stewart

        There is no standard way - this is what programs do. You must decide the saving and loading routines. If you want to write a text file, you can use a TextWriter derivative, like StreamWriter or simply use File.CreateText. When you read it, use a TextReader or simply File.ReadText (which returns a TextReader, an abstract class for other classes like StreamReader. If you want to write binary files, you can use FileStream to both read and write. If you want to store these attributes (like the phone number) in an object and serialize that to XML (a text format), then use XmlSerializer defined in the System.Xml namespace. There's really a seemingly infinite ways of accomplishing this task and it all depends on what you want to do. This is a basic concept, however. I recommend that you read the .NET Framework SDK - especially the programming topics - and pick up a book or two on developing applications with .NET. If you read the .NET Framework SDK - and you should - the class documentation for those classes I mentioned above even have examples. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

        W Offline
        W Offline
        WartHog000
        wrote on last edited by
        #3

        Thanks for Tips. WartHog

        D 1 Reply Last reply
        0
        • W WartHog000

          Thanks for Tips. WartHog

          D Offline
          D Offline
          dbetting
          wrote on last edited by
          #4

          It seems that specific books aren't usually recommended here (always the SDK's) but I lived in the C# Unleashed book (published by Sams) for the first six months of C#. Since then, I always have it handy along with Mastering Visual C# .Net which is published by Sybex. I know, the SDKs are free, but for the clarity, the $40 each was worth it! Between the two, you will find how to do just about everything you need to do. In your projects, you will hit very specific advanced things you want to do (like change colors in a grid) which may not be clear. Then you visit the trusty The Code Project and pull up one of the many examples. Good luck.

          W 1 Reply Last reply
          0
          • D dbetting

            It seems that specific books aren't usually recommended here (always the SDK's) but I lived in the C# Unleashed book (published by Sams) for the first six months of C#. Since then, I always have it handy along with Mastering Visual C# .Net which is published by Sybex. I know, the SDKs are free, but for the clarity, the $40 each was worth it! Between the two, you will find how to do just about everything you need to do. In your projects, you will hit very specific advanced things you want to do (like change colors in a grid) which may not be clear. Then you visit the trusty The Code Project and pull up one of the many examples. Good luck.

            W Offline
            W Offline
            WartHog000
            wrote on last edited by
            #5

            Thanks I will keep it in mind-its sounds really useful. -WartHog

            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