Save
-
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
-
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
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, likeStreamWriter
or simply useFile.CreateText
. When you read it, use aTextReader
or simplyFile.ReadText
(which returns aTextReader
, an abstract class for other classes likeStreamReader
. If you want to write binary files, you can useFileStream
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 useXmlSerializer
defined in theSystem.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] -
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, likeStreamWriter
or simply useFile.CreateText
. When you read it, use aTextReader
or simplyFile.ReadText
(which returns aTextReader
, an abstract class for other classes likeStreamReader
. If you want to write binary files, you can useFileStream
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 useXmlSerializer
defined in theSystem.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]Thanks for Tips. WartHog
-
Thanks for Tips. WartHog
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.
-
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.
Thanks I will keep it in mind-its sounds really useful. -WartHog