当前位置: 首页 > news >正文

dsicuz做的网站客户做网站一定报价怎么办

dsicuz做的网站,客户做网站一定报价怎么办,印刷行业网站建设,wordpress外国模板目录 英雄信息类 因为要在两个窗体里面调用字典,所以要写两个类来构建全局变量 添加功能 查询功能 英雄信息类 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApp…

目录

英雄信息类

因为要在两个窗体里面调用字典,所以要写两个类来构建全局变量

 添加功能

 查询功能


英雄信息类

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1
{
  public  class hero
    {
      public int Id;
      public string Name;
      public int Money;
      public string Type;
      public hero(int id,string name,int money,string type) {
          Id = id;
          Name = name;
          Money = money;
          Type = type;
      }
    }
}

因为要在两个窗体里面调用字典,所以要写两个类来构建全局变量

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1
{

    internal class Class1
    {
        public Dictionary<string ,hero > dic;

        public Class1()
        {
            dic = new Dictionary<string, hero>();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1
{
    class Class2
    {

        public static Class1 data = new Class1();
    }
}
 

 添加功能

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

namespace WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int id = int.Parse(textBox1.Text);
            string name = textBox2.Text;
            int money = int.Parse(textBox3.Text);
            string object1 = textBox4.Text;
            hero h = new hero(id, name, money, object1);
            Class2.data.dic[name] = h;
           
            // int s = Class2.data.dic[name].Money;
          //  MessageBox.Show(s.ToString());

        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
 

 查询功能

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

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();

        }
       
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();
            f.ShowDialog();
            NewMethod();
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            NewMethod();
        }

        private void NewMethod()
        {
            this.dataGridView1.Rows.Clear();

            for (int i = 0; i < Class2.data.dic.Keys.Count; i++)
            {
                string nam = Class2.data.dic.Keys.ElementAt(i);

                hero h = Class2.data.dic[nam];
                DataGridViewRow row = new DataGridViewRow();

                row.CreateCells(dataGridView1);
                row.Cells[0].Value = h.Id;
                row.Cells[1].Value = h.Name;
                row.Cells[2].Value = h.Money;
                row.Cells[3].Value = h.Type;
                dataGridView1.Rows.Add(row);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text=="")
            {
                  NewMethod();
            }
            else
            {
                this.dataGridView1.Rows.Clear();
                string name = textBox1.Text;

                for (int i = 0; i < Class2.data.dic.Keys.Count; i++)
                {
                    string nam = Class2.data.dic.Keys.ElementAt(i);
                    if (nam==name)
                    {
                        hero h = Class2.data.dic[nam];
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(dataGridView1);
                        row.Cells[0].Value = h.Id;
                        row.Cells[1].Value = h.Name;
                        row.Cells[2].Value = h.Money;
                        row.Cells[3].Value = h.Type;
                        dataGridView1.Rows.Add(row);
                    }                 
                }
            }
        }     
    }
}
 

http://www.yayakq.cn/news/177694/

相关文章:

  • 山西网站建设哪家好品牌网站推广
  • 织梦做中英文网站步骤中国企业500强2021名单
  • 平凉市城乡建设局网站百度开发者平台
  • 珠海网站快速排名提升网站建设过程的结构图
  • 在手机上怎么做网站如何在网站上做标注
  • 网站开发课程百度云莞城网站建设
  • 网站开发做什么郑州膏药网站建设
  • 聚来宝网站建设网站开发的技术问题
  • 做网站是用c 吗网站优化基础
  • 给个龙做罗拉的网站js网站源码
  • 去掉博客网站链接后面的wordpress网站域名推广
  • 做销售如何在网站上搜集资料平阳网站开发
  • 哈尔滨网站建设资海遵义酷虎网站开发
  • 众筹网站功能农业推广作业
  • 做药品网站有哪些长安做网站公司
  • Html5移动网站变装改造wordpress
  • 网站引导页是什么阜宁做网站的公司电话
  • 做网站 报价 需要了解页游传奇
  • 做网站需要用什麼服务器网站建设wuhan
  • 开发网站的技术路线网址推荐网页设计素材
  • pexels免费素材网站建立全国统一大市场
  • dede 电商网站模板网站流量图怎么做的
  • 哈尔滨网站开发建设公司电话wordpress dx seo
  • 永久免费网站申请注册简述网站制作的步骤
  • wordpress分页无效石家庄seo公司
  • 威海建设招聘信息网站推广优化seo
  • 西部数码网站管理助手破解版电子商务网站建设的工具
  • 卖普洱茶做网站wordpress邮件验证码
  • 江门模板建站哪家好网站设计公司市场容量
  • 株洲网站做的好的公司业务网站在线生成