메뉴 건너뛰기

Programing

C# 게시판

설문조사구현

관리자2 2018.12.26 19:01 조회 수 : 220

폼1

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 ts12

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void btnPoll_Click(object sender, EventArgs e)

        {

            Form2 frm2 = new Form2();

            frm2.Text = this.txtName.Text + "님의 설문조사";

            if(this.rb01.Checked == true)

            {

                frm2.lblHobby.Text = this.rb01.Text;

            }

            else if (this.rb02.Checked == true)

            {

                frm2.lblHobby.Text = this.rb02.Text;

            }

            else if (this.rb03.Checked == true)

            {

                frm2.lblHobby.Text = this.rb03.Text;

            }

            else if (this.rb04.Checked == true)

            {

                frm2.lblHobby.Text = this.rb04.Text;

            }

            frm2.lblSports.Text = "";

            if (this.cb01.Checked == true)

            {

                frm2.lblSports.Text = " "+ this.cb01.Text;

            }

            if (this.cb02.Checked == true)

            {

                frm2.lblSports.Text = " " + this.cb02.Text;

            }

            if (this.cb03.Checked == true)

            {

                frm2.lblSports.Text = " " + this.cb03.Text;

            }

            if (this.cb04.Checked == true)

            {

                frm2.lblSports.Text = " " + this.cb04.Text;

            }

            this.Hide();

            frm2.Show();

        }

    }

}

폼2
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 ts12
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
 
        private void gbHobby_Enter(object sender, EventArgs e)
        {
 
        }
 
        private void btnClose_Click(object sender, EventArgs e)
        {
            if(this != null)
            {
                Application.Exit();
            }
        }
    }
}
폼1에서 설문조사 후 확인을 누르면 폼2로 가서 결과를 보여준다.
위로