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 & open file...

save & open file...

Scheduled Pinned Locked Moved C#
help
6 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.
  • M Offline
    M Offline
    mr jets
    wrote on last edited by
    #1

    good morning ..every one ! ok..i wanna to make aprograme that can draw(ellipse,lines,..) but i have aproblems with saving & opening file ..my save code is: FileStream outStream=File.Create(saveFileDialog1.FileName);//To create text file StreamWriter streamWriter=new StreamWriter(outStream); the error...>>(cannot implicity convert type 'System.IO.StreamWritet'to 'System.IO.Stream'. plzz send me back...as fast as u can Regards;:)

    C 1 Reply Last reply
    0
    • M mr jets

      good morning ..every one ! ok..i wanna to make aprograme that can draw(ellipse,lines,..) but i have aproblems with saving & opening file ..my save code is: FileStream outStream=File.Create(saveFileDialog1.FileName);//To create text file StreamWriter streamWriter=new StreamWriter(outStream); the error...>>(cannot implicity convert type 'System.IO.StreamWritet'to 'System.IO.Stream'. plzz send me back...as fast as u can Regards;:)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      mr jets wrote:

      as fast as u can

      I recommend not saying things like this when asking for free advice. System.IO.File.WriteAllLines or System.IO.File.WriteAllText are the easiest way to create a text file. Having said that, your code compiles just fine here. What line gives the error ?

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      M 1 Reply Last reply
      0
      • C Christian Graus

        mr jets wrote:

        as fast as u can

        I recommend not saying things like this when asking for free advice. System.IO.File.WriteAllLines or System.IO.File.WriteAllText are the easiest way to create a text file. Having said that, your code compiles just fine here. What line gives the error ?

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        M Offline
        M Offline
        mr jets
        wrote on last edited by
        #3

        ok frist of all ..iam sorry bout my behavior but save & open its apart of very very huge program ..the dead line after 5 hours..so thank god i didnt kill my some one .. ok the error at ...: StreamWriter streamWriter=new StreamWriter(outStream); plzz if u know more simple code..i will invite u to cinema..kidding!!:omg:

        C 1 Reply Last reply
        0
        • M mr jets

          ok frist of all ..iam sorry bout my behavior but save & open its apart of very very huge program ..the dead line after 5 hours..so thank god i didnt kill my some one .. ok the error at ...: StreamWriter streamWriter=new StreamWriter(outStream); plzz if u know more simple code..i will invite u to cinema..kidding!!:omg:

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Building the string and using WriteAllText is definately simpler. I don't get the error, because, like I said, it compiled fine here.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          M 2 Replies Last reply
          0
          • C Christian Graus

            Building the string and using WriteAllText is definately simpler. I don't get the error, because, like I said, it compiled fine here.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            M Offline
            M Offline
            mr jets
            wrote on last edited by
            #5

            and using WriteAllText is definately simpler..iam not familiar with that..how will be the code look like..?!:doh:

            1 Reply Last reply
            0
            • C Christian Graus

              Building the string and using WriteAllText is definately simpler. I don't get the error, because, like I said, it compiled fine here.

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

              M Offline
              M Offline
              mr jets
              wrote on last edited by
              #6

              ok i give up ..i really need ur help bro..its apart of my code..where is the wrong ?! using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; namespace graphics_practis { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Panel panel1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Button line; private System.Windows.Forms.Button square; private System.Windows.Forms.Button circle; private System.Windows.Forms.Button ellipse; private System.Windows.Forms.Button polygon; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button ok; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.MenuItem menuItem5; private BinaryFormatter formtter = new BinaryFormatter(); private FileStream str_reader; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.SaveFileDialog saveFileDialog1; private System.Windows.Forms.OpenFileDialog openFileDialog1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // dr = new draw(this.pictureBox1); } static void Main() { Application.Run(new Form1()); } private void menuItem4_Click(object sender, System.EventArgs e) { //saving FileStream outStream=File.Create(saveFileDialog1.FileName);//To create text file Stream streamWriter=new StreamWriter(outStream); } private void menuItem3_Click(object sender, System.EventArgs e) { //opening FileStream outStream=File.Create(saveFileDialog1.FileName);//To create text file StreamWriter streamWriter=new StreamWriter(outStream); }

              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