93. WinForm을 이용한 체중 관리 프로그램
.NET프로그래밍/WinForm 2009. 8. 20. 18:35 |
==> Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace 체중관리프로그램
{
static class Program
{
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Frm입력());
}
}
}
==============================================================================================
==> Weight.cs
using System;
public class Weight
{
public int 반 { get; set; }
public int 번호 { get; set; }
public int 몸무게 { get; set; }
public Weight(int 반, int 번호, int 몸무게)
{
this.반 = 반; this.번호 = 번호; this.몸무게 = 몸무게;
}
}
==============================================================================================
==> Frm입력.cs
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 체중관리프로그램
{
public partial class Frm입력 : Form
{
public Frm입력()
{
InitializeComponent();
lst = new List<Weight>();
}
private List<Weight> lst;
private void btn입력_Click(object sender, EventArgs e)
{
lst.Add(new Weight(Convert.ToInt32(txt반.Text)
, Convert.ToInt32(txt번호.Text)
, Convert.ToInt32(txt몸무게.Text)));
// 텍스트박스 클리어
txt반.Text = "";
txt번호.Text = String.Empty;
txt몸무게.Clear();
}
private void btn출력_Click(object sender, EventArgs e)
{
Frm출력 f = new Frm출력(lst);
f.Show(); // 출력 창 띄우고,
this.Hide(); // 현재 폼 숨기고
}
}
}
==============================================================================================
==> Frm출력.cs
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 체중관리프로그램
{
public partial class Frm출력 : Form
{
public Frm출력()
{
InitializeComponent();
}
private List<Weight> lst;
public Frm출력(List<Weight> lst)
{
InitializeComponent(); // 폼 초기화
this.lst = lst;
}
private void Frm출력_Load(object sender, EventArgs e)
{
this.ctlPrint.DataSource = lst; // 출력(알아서)
}
}
}
< 실행결과 >
==> 입력 폼
==> 출력 폼
'.NET프로그래밍 > WinForm' 카테고리의 다른 글
95. 체크박스(CheckBox) / 라디오버튼(RadioButton) (0) | 2009.08.21 |
---|---|
94. 버튼 / 레이블 / 텍스트박스 (Button / Label / TextBox) (0) | 2009.08.21 |
(테스트) 인터넷쇼핑몰 - WinForm을 이용하여 회원으로부터 회원번호, 주문상품코드, 주문수량을 입력받아 결과를 출력하는 프로그램 (0) | 2009.08.21 |
92. MenuStrip / ContextMenuStrip / StatusStrip / 모달 폼 / 모달리스 폼 (0) | 2009.08.20 |
91. WinForm 시작 - HelloWorld (0) | 2009.08.20 |