Click here to Skip to main content
15,915,172 members
Home / Discussions / C#
   

C#

 
AnswerRe: Save and Save as Pin
GenJerDan2-Dec-10 11:29
GenJerDan2-Dec-10 11:29 
GeneralRe: Save and Save as Pin
squerley2-Dec-10 12:15
squerley2-Dec-10 12:15 
GeneralRe: Save and Save as Pin
GenJerDan2-Dec-10 17:22
GenJerDan2-Dec-10 17:22 
GeneralRe: Save and Save as Pin
Dalek Dave2-Dec-10 12:27
professionalDalek Dave2-Dec-10 12:27 
AnswerRe: Save and Save as Pin
Luc Pattyn2-Dec-10 12:10
sitebuilderLuc Pattyn2-Dec-10 12:10 
AnswerRe: Save and Save as Pin
_Erik_3-Dec-10 3:22
_Erik_3-Dec-10 3:22 
GeneralRe: Save and Save as Pin
squerley3-Dec-10 8:59
squerley3-Dec-10 8:59 
GeneralRe: Save and Save as Pin
squerley4-Dec-10 16:08
squerley4-Dec-10 16:08 
Well i think i got this thing working =^)except for one thing the save method?

I cant seem to figure out how to have it save back to its original place.

This is what i got for my save_click event

private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog Save_File = new SaveFileDialog();

            Save_File.Title = "File Saved";
            Save_File.Filter = "Text Files|*.txt|All Files (*.*)|*.*";

            DialogResult dr = Save_File.ShowDialog();
            try
            {
                if (saveFileDialog1.FileName != "")
                {
                    StreamWriter sw = new StreamWriter(Save_File.FileName);
                    sw.Write(txtBox);
                    sw.Close();
                }

                if (dr == DialogResult.OK)
                {
                    StreamWriter sw = new StreamWriter(Save_File.FileName);
                    sw.Write(txtBox.Text);

                    sw.Close();
                }
            }
            catch
            {
                SaveAs();
            }                       
        }


I know this displays a dialog box for asking where to save the file...


i also tried this to and still nothing

if (saveFileDialog1.FileName != "")
  {
    richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
  }
  else
  {
    evtSaveAs_Click(sender, e);
  }


now should i create a Save method or is this fine? I know by creating a method i can use the same code in multiple places with out needing to write it all over again. But this is such a small app.

All you guys Rock Thanks so Much for your help ?=^)
Peace
GeneralRe: Save and Save as Pin
_Erik_6-Dec-10 23:35
_Erik_6-Dec-10 23:35 
GeneralRe: Save and Save as Pin
squerley10-Dec-10 15:46
squerley10-Dec-10 15:46 
QuestionHow to delete word field code from C# Pin
Andraw Tang2-Dec-10 8:45
Andraw Tang2-Dec-10 8:45 
QuestionXPathNavigator iterate and write Pin
Mark F.2-Dec-10 5:38
Mark F.2-Dec-10 5:38 
AnswerRe: XPathNavigator iterate and write Pin
cechode2-Dec-10 13:15
cechode2-Dec-10 13:15 
GeneralRe: XPathNavigator iterate and write [modified] Pin
Mark F.3-Dec-10 9:00
Mark F.3-Dec-10 9:00 
AnswerRe: XPathNavigator iterate and write Pin
cechode3-Dec-10 9:34
cechode3-Dec-10 9:34 
QuestionAvoid Peer 2 Peer acces Pin
utunity2-Dec-10 5:08
utunity2-Dec-10 5:08 
AnswerRe: Avoid Peer 2 Peer acces Pin
musefan2-Dec-10 5:36
musefan2-Dec-10 5:36 
GeneralRe: Avoid Peer 2 Peer acces Pin
utunity2-Dec-10 5:45
utunity2-Dec-10 5:45 
GeneralRe: Avoid Peer 2 Peer acces Pin
musefan2-Dec-10 5:51
musefan2-Dec-10 5:51 
GeneralRe: Avoid Peer 2 Peer acces Pin
Luc Pattyn2-Dec-10 7:48
sitebuilderLuc Pattyn2-Dec-10 7:48 
GeneralRe: Avoid Peer 2 Peer acces Pin
fjdiewornncalwe3-Dec-10 1:15
professionalfjdiewornncalwe3-Dec-10 1:15 
AnswerRe: Avoid Peer 2 Peer acces Pin
T M Gray2-Dec-10 11:08
T M Gray2-Dec-10 11:08 
QuestionFlickering Pin
peropata2-Dec-10 3:43
peropata2-Dec-10 3:43 
AnswerRe: Flickering Pin
musefan2-Dec-10 3:52
musefan2-Dec-10 3:52 
AnswerRe: Flickering Pin
phil.o2-Dec-10 4:07
professionalphil.o2-Dec-10 4:07 

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.