Click here to Skip to main content
16,006,535 members
Home / Discussions / C#
   

C#

 
GeneralRe: Engineering Design Pin
PIEBALDconsult26-Nov-08 13:35
mvePIEBALDconsult26-Nov-08 13:35 
GeneralRe: Engineering Design Pin
Christian Graus26-Nov-08 13:35
protectorChristian Graus26-Nov-08 13:35 
GeneralRe: Engineering Design Pin
Mycroft Holmes26-Nov-08 16:11
professionalMycroft Holmes26-Nov-08 16:11 
GeneralRe: Engineering Design Pin
Luc Pattyn26-Nov-08 16:56
sitebuilderLuc Pattyn26-Nov-08 16:56 
GeneralRe: Engineering Design Pin
Mycroft Holmes26-Nov-08 17:10
professionalMycroft Holmes26-Nov-08 17:10 
GeneralRe: Engineering Design Pin
Luc Pattyn26-Nov-08 17:26
sitebuilderLuc Pattyn26-Nov-08 17:26 
GeneralRe: Engineering Design Pin
viciouskinid26-Nov-08 18:08
viciouskinid26-Nov-08 18:08 
QuestionSave and Save As for this xml/c# code Pin
Chris Kentlea26-Nov-08 8:59
Chris Kentlea26-Nov-08 8:59 
The code below is for a button which saves the details on a form to the xml file. What I'm trying to do is get it so that:
a)It has a "Save" option
b)It also hase a "Save as" and creates a new file(name etc)

but, for the life of me i cant see what i'm doing wrong

private void button1_Click(object sender, EventArgs e)
{
    if (openFileDialog1.FileName.Length > 0)
        {
            string path = openFileDialog1.FileName; // The Path to the .Xml file //
            FileStream READER = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); //Set up the filestream (READER) //
            System.Xml.XmlDocument CharDetail = new System.Xml.XmlDocument();// Set up the XmlDocument (CharDetail) //
            CharDetail.Load(READER); //Load the data from the file into the XmlDocument (CharDetail) //

            System.Xml.XmlNodeList NodeList = CharDetail.GetElementsByTagName("Character");

            NodeList[0].FirstChild.ChildNodes[0].InnerText = CharName.Text;
            NodeList[0].FirstChild.ChildNodes[1].InnerText = Virtue.Text;
            NodeList[0].FirstChild.ChildNodes[2].InnerText = Vice.Text;

            //Save the xml file
            //Create a FileStream for writing
            FileStream WRITER = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); //Set up the filestream (READER) //
            //Write the data to the filestream
            CharDetail.Save(WRITER);
        }

}

This is the code for the SAVE function(eg overwrites the current file)..i'm trying to add a SAVE AS functionality to it

Now I know that the SaveFileDialog box should be used but where/how would i intergrate it?
AnswerRe: Save and Save As for this xml/c# code [modified] Pin
Pedram Behroozi26-Nov-08 9:19
Pedram Behroozi26-Nov-08 9:19 
GeneralRe: Save and Save As for this xml/c# code Pin
Chris Kentlea26-Nov-08 9:34
Chris Kentlea26-Nov-08 9:34 
GeneralRe: Save and Save As for this xml/c# code Pin
Luc Pattyn26-Nov-08 9:43
sitebuilderLuc Pattyn26-Nov-08 9:43 
GeneralRe: Save and Save As for this xml/c# code Pin
Chris Kentlea26-Nov-08 9:45
Chris Kentlea26-Nov-08 9:45 
GeneralRe: Save and Save As for this xml/c# code Pin
Pedram Behroozi26-Nov-08 9:48
Pedram Behroozi26-Nov-08 9:48 
AnswerRe: Save and Save As for this xml/c# code Pin
Christian Graus26-Nov-08 10:01
protectorChristian Graus26-Nov-08 10:01 
QuestionMultiThreading, went back to basics.. Pin
EliottA26-Nov-08 7:56
EliottA26-Nov-08 7:56 
AnswerRe: MultiThreading, went back to basics.. Pin
Rob Philpott26-Nov-08 8:08
Rob Philpott26-Nov-08 8:08 
GeneralRe: MultiThreading, went back to basics.. Pin
EliottA26-Nov-08 8:23
EliottA26-Nov-08 8:23 
GeneralRe: MultiThreading, went back to basics.. Pin
Dan Neely26-Nov-08 8:49
Dan Neely26-Nov-08 8:49 
GeneralRe: MultiThreading, went back to basics.. Pin
EliottA26-Nov-08 8:28
EliottA26-Nov-08 8:28 
QuestionRe: MultiThreading, went back to basics.. Pin
led mike26-Nov-08 8:33
led mike26-Nov-08 8:33 
AnswerRe: MultiThreading, went back to basics.. Pin
EliottA26-Nov-08 8:35
EliottA26-Nov-08 8:35 
AnswerRe: MultiThreading, went back to basics.. Pin
Dan Neely26-Nov-08 8:47
Dan Neely26-Nov-08 8:47 
AnswerRe: MultiThreading, went back to basics.. Pin
Luc Pattyn26-Nov-08 10:02
sitebuilderLuc Pattyn26-Nov-08 10:02 
GeneralRe: MultiThreading, went back to basics.. Pin
EliottA26-Nov-08 10:10
EliottA26-Nov-08 10:10 
GeneralRe: MultiThreading, went back to basics.. Pin
Luc Pattyn26-Nov-08 10:38
sitebuilderLuc Pattyn26-Nov-08 10:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.