如题。

解决方案 »

  1.   

       FileStream aFile = new FileStream("Barcode.txt", FileMode.OpenOrCreate);
                    //StreamWriter sw = new StreamWriter("Barcode.txt", false);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine(DateTime .Today .ToString ());
                    sw.WriteLine(strBarcode,true );
                    sw.Close();
      

  2.   


                FileDialog _FileOpenDialog = new FileDialog();            if (_FileOpenDialog.ShowDialog() == DialogResult.OK)
                {
                    System.IO.FileStream _FileStream = new System.IO.FileStream(_FileOpenDialog.FileName);
                    _FileStream.Read();            }
      

  3.   

    using System.IO;   a.         Stream fileStream = File.Open("YourFile", FileMode.Open);   b.         FileInfo info = new FileInfo("YourFile");
                  Stream fileStream = info.Open(FileMode.Open);   c.         StreamReader fileStream = new StreamReader("YourFile");
      

  4.   

    System.Diagnostics.Process.Start(@"C:\Documents and Settings\S0807002\桌面\知足.mp3");
      

  5.   

    只要打来文件就可以了,文件类型:txt,xls,pdf,doc。
    请帮忙看下。
      

  6.   

    打开文件?用C#调用相关的程序,比如 doc就word ;pdf 就adobe;txt 就notepad
      

  7.   

    5楼的就可以了!
    System.Diagnostics.Process.Start("文件路径");你本机上只要安装了能打开此类文件的软件,那只需要提供文件路径就可以啦!
    如果要指定用哪个程序打开可以System.Diagnostics.Process.Start("notepad.exe","文件路径");//打开TXT  
      

  8.   


                using System.IO;
                FileStream fs = null;
                //设置文件读取路径
                fs = File.Open(" e:\\File\\test.txt", FileMode.Open);
                byte[] content = new byte[100000];
                int getLength = 0;
                while ((getLength = fs.Read(content, 0, content.Length)) != 0)
                {
                    this.TextBox1.Text = System.Text.Encoding.Default.GetString(content, 0, getLength);
                    string str=this.TextBox1.Text;
                    //得到time在字符串中的索引
                    string index=str.IndexOf("Time");
                    //再截取,8为time长度,可自己改.
                    string time=str.Substring(index, 8);
                }
                fs.Close();
      

  9.   

     OpenFileDialog dlg = new OpenFileDialog();  //  新建打开对象
     dlg.Filter = "XML文件(*.XML)|*.xml";  //筛选打开的文件格式,我这里举例XML文件
    dlg.Multiselect = true;                //允许多选
        if (dlg.ShowDialog() == DialogResult.OK & dlg.FileName != "")
        {
     for (int i = 0; i < dlg.FileNames.Length; i++)
    {
     filepath = dlg.FileNames[i];  //filepath为获得的文件路径地址
    }
    }
      

  10.   


    If only need open file.This is OK.
      

  11.   

    using System;
    using System.IO;class Test 
    {
        public static void Main() 
        {
            string path = @"c:\temp\MyTest.txt";
            if (!File.Exists(path)) 
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(path)) 
                {
                    sw.WriteLine("Hello");
                    sw.WriteLine("And");
                    sw.WriteLine("Welcome");
                }
            }        // Open the file to read from.
            using (StreamReader sr = File.OpenText(path)) 
            {
                string s = "";
                while ((s = sr.ReadLine()) != null) 
                {
                    Console.WriteLine(s);
                }
            }        try 
            {
                string path2 = path + "temp";
                // Ensure that the target does not exist.
                File.Delete(path2);            // Copy the file.
                File.Copy(path, path2);
                Console.WriteLine("{0} was copied to {1}.", path, path2);            // Delete the newly created file.
                File.Delete(path2);
                Console.WriteLine("{0} was successfully deleted.", path2);
            } 
            catch (Exception e) 
            {
                Console.WriteLine("The process failed: {0}", e.ToString());
            }
        }
    }