Form1.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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 button1_Click(object sender, EventArgs e) { int len = Talker.BlahBlahBlah(textBox1.Text, (int)numericUpDown1.Value); MessageBox.Show("The message length is " + len); } } } | cs |
Talker.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { class Talker { public static int BlahBlahBlah(string thingToSay, int numberOfTimes) { string finalString = ""; for (int count = 0; count < numberOfTimes; count++) { finalString += thingToSay + "\n"; } MessageBox.Show(finalString); return finalString.Length; } } } [출처] c# head first - MessageBox 사용|작성자 길가다주은노트북 |
'프로그래밍 > C#' 카테고리의 다른 글
(C#) Head First - 캡슐화 PartyPlaner (0) | 2016.07.09 |
---|---|
(C#) Head First - 캡슐화 (0) | 2016.07.09 |
(C#) Head First - 경마 (0) | 2016.07.09 |
(C#) WPF로 만든 심플 게임 (1) | 2016.07.09 |
(C#) 엑세스 수식자, 예외처리 (0) | 2016.07.09 |