728x90
반응형
설문조사 APP 구현
Form 디자인
제출버튼(btnPoll)을 클릭했을때의 코드 추가
/*
foreach (컬렉션의 요소를 반복하는데 사용되는 변수 in Object 변수)
{
// 실행문;
}
*/
private void btnPoll_Click(object sender, EventArgs e)
{
if(this.CB1.Checked!=false||this.CB2.Checked!=false)
{
foreach(RadioButton c in this.GB_Hobby.Controls)
{
if (c.Checked == true)
this.Label_Hobby.Text = c.Text;
}
this.Label_Singer.Text = "";
foreach (CheckBox c in this.GB_Singer.Controls)
{
if(c.Checked==true)
{
this.Label_Singer.Text += c.Text +" ";
}
}
}
} |
Output :
라디오 버튼과 체크박스(중복선택 가능)를 통해 설문에 응답하고 결과 제출
제출결과는 아래 (Panel_Result)에 표시된다.
프로젝트 파일
C# 기초 복습
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bool
{
class MainApp
{
static void Main(string[] args)
{
bool a = true;
bool b = false;
Console.WriteLine(a);
Console.WriteLine(b);
}
}
}
Output:
True
False
bool은 true, false 데이터를 다루며 1바이트 크기의 type이다. (1비트만으로 표현가능하지만 컴퓨터가 기본적으로 바이트 단위를 사용하므로)
Object 형식 : 어떤 형식의 데이터라도 object 담아 처리할 수 있다. (int, long, char, bool, string...)
ex) object a=123; object b=3.14f; object c = true; object d = "hello";
12345
3.14
False
True
True
True
3
True
False
10
11
12
50
51
728x90
'코스웨어 > 16년 스마트컨트롤러' 카테고리의 다른 글
2016-05-22_조재찬_스터디일지-C# 클래스 복습 (0) | 2016.05.22 |
---|---|
2016-05-20_조재찬_스터디일지-C# 메소드와 클래스 복습 (0) | 2016.05.20 |
이름 (0) | 2016.05.20 |
2016-05-19_조재찬_업무일지_ AVR-LCD출력 & C#-성적관리 프로그램 (0) | 2016.05.20 |
2016-05-18_조재찬_업무일지_ C#-OOP와 클래스 (0) | 2016.05.18 |
2016-05-17_조재찬_업무일지_AVR 입출력/ C#메소드 (0) | 2016.05.17 |
2016-05-16_조재찬_업무일지_AVR 입출력/ C#기초 (0) | 2016.05.16 |
칸 아카데미 암호학 강좌 (2) | 2016.05.14 |