标题:C#类、结构或接口成员声明中的标记“(”无效
取消只看楼主
waxiaoguai
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-6-1
结帖率:0
已结贴  问题点数:20 回复次数:0 
C#类、结构或接口成员声明中的标记“(”无效
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using

namespace 文件
{
    public partial class Form1 : Form

      {      int []a=new int [10];
  
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string path = "aa.txt"; 
             string mystr = "";
            FileStream fs = File.OpenRead(path);
             StreamReader sr = new StreamReader(fs, Encoding.Default );
            //指定打开文件
            string str;
            int max=0;
            while ((str =sr .ReadLine())!=null )
            {
                mystr = mystr + str + "\r\n";  //\r\n表示回车换行
               int t=0;
                t=Convert .ToInt16 (str );
                if(max<t )
                    max =t ;
            }
                sr.Close();
                fs.Close();
                richTextBox1.Text = mystr;
           textBox1 .Text  =max.ToString();

        }

        private void button2_Click(object sender, EventArgs e)
        {
             Random rdm = new Random();
            bool flag;
            for (int i = 0; i < 10; i++)
            {
                while (true)
                {
                    t = rdm.Next(0, 101);
                    flag = true;
                    for (int j = 0; j < i - 1; j++)
                        if (a[j] == t) flag = false;
                    if (flag == true) break;
                }
                a[i] = t;
            }
            int max = 0;
            for (int i = 1; i < 10; i++)
            {  
                richTextBox1.Text += a[i].ToString() + "\r\n";
               if (max < a[i])
                max =  a[i];
             }
             textBox1 .Text  = max.ToString();
        }

        string pa = "aa.txt";
        FileStream fr = new FileStream("aa.txt", FileMode.Append);
        StreamWriter sr = new StreamWriter(fr, Encoding.Default);
        sr.WriteLine( richTextBox1.Text );//C#类、结构或接口成员声明中的标记“(”无效
        sr.Close();
        fs.Close();

        }
    }




        
   

        
搜索更多相关主题的帖子: private 
2011-06-01 11:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-341605-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042818 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved