找传奇、传世资源到传世资源站!

记录查询程式(C#读取txt中的数据到datagridview)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

新增和查询数据 都是基于txt
from clipboard  private void LoadData(string kind)
        {
            listView.Items.Clear();
            StreamReader streamReader = new StreamReader("Recorder.txt");
            try
            {
                while (!streamReader.EndOfStream)
                {
                    string nstr = streamReader.ReadLine();
                    string kstr = streamReader.ReadLine();
                    if((kind == "所有") || (kind == kstr))
                    {
                        ListViewItem item = listView.Items.Add(nstr);
                        item.SubItems.Add(kstr);
                        item.SubItems.Add(streamReader.ReadLine());
                        item.SubItems.Add(streamReader.ReadLine());
                        item.SubItems.Add(streamReader.ReadLine());
                    }
                    else
                    {
                        streamReader.ReadLine();
                        streamReader.ReadLine();
                        streamReader.ReadLine();
                    }

                }
            }
            catch (Exception ex)
            {
                //
            }
            finally
            {
                streamReader.Close();
            }
        }

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复