日期:2014-05-20  浏览次数:20996 次

简单的投票系统,求大神指导,跪求!!!!
需求分析:
一个主窗体投票,一个窗体显示投票情况,我上两个图给大神看。
现在我的困难是,我点击投票后,我根本无法让显示投票的窗口的数据进行动态绑定。。
我用的数组,我的思路是:当主窗口投票系统,每当他选中一个人,点击投票后,我就在投票系统当中让那个人的数据加1,但是我有想法实现不了,技术不够过硬。
------解决方案--------------------
http://bbs.csdn.net/topics/360140208
------解决方案--------------------
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 TpSystem
{
    public partial class Form1 : Form
    {
        //各人的票数
        private int num1 = 0;
        private int num2 = 0;
        private int num3 = 0;
        public Form1()
        {
            InitializeComponent();
            label1.Text = "张三:";
            label2.Text = "李四:";
            label3.Text = "王五:";

            //设置三个按钮的样式
            foreach (Control c in this.Controls)
            {
                if (c.GetType() == typeof(Button))
                {
                    Button btn = (Button)c;
                    btn.BackColor = Color.Red;
                    btn.Width = 15;
                    btn.TextAlign = ContentAlignment.MiddleLeft;
                    btn.FlatAppearance.BorderSize = 0;
                    btn.FlatStyle = FlatStyle.Flat;
                    btn.Click += new EventHandler(btn_Click);
                }
            }
            showNumber();
            //button1.s

        }

        void btn_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            switch (btn.Name)
            {
                case "button1":
                    {
                        num1 += 1;
                        break;
                    }
                case "button2":
                    {
                        num2 += 1;
                        break;
                    }
                case "button3":
                    {
                        num3 += 1;