Form1.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AskQuestionInClass
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        string filename = null;
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //如果选择文件后,点击OK按钮则将选区文件赋值给FileDialog
                filename = openFileDialog1.FileName;
                //openFileDialog1.FileName;FileName是包含了文件路劲和文件名字的一个字符串
            }
            else
            {
                MessageBox.Show("你没有选择文件!是否放弃选择?");
                return;
            }
        }

        //集合 list<>;dictiongary<,>或者数组;
        List<string> studentlist;//用来储存学生名单,提供名单自动抽取时的载体
        string[] newstulist;//同来与文本文件名单对接,用来读取数据
        private void button2_Click(object sender, EventArgs e)
        {
            if (filename == "")
            {
                MessageBox.Show("没有选择班级名单或者名单为空");
                    return;
            }
            else
            {
                studentlist = System.IO.File.ReadAllLines(filename).ToList();
                //将文本文件的学生名单读取出来,存在list集合中
                if(button2.Text=="开始")
                {
                    timer1.Start();
                    button2.Text = "结束";
                }
                else
                {
                    timer1.Stop();
                    button2.Text = "开始";
                }
            }
        }
后面还有 15 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。