2. TEXTBOX - sandeulsandeul/let-s-learning-C-winForm- GitHub Wiki
`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 WindowsFormsApp2 { public partial class Form1 : Form {
public Form1()
{
/*public Form1 ์ด๋ผ๋ ์ฐฝ ํ๋ฉด์
InitializeComponent();ํจ์๋ฅผ ์ ์ฉํด
๋์์ธํ ํ๋ฉด์ผ๋ก์ ์ฉ*/
InitializeComponent();
/*button1์ด ํด๋ฆญ๋์์ ๋ button_Click() ํจ์ ์ ์ฉ */
this.button1.Click += new System.EventHandler(this.button1_Click_1);
}
/*private (ํด๋์ค ๋ด์์๋ง ์ ๊ทผ ๊ฐ๋ฅ )๋ก button1_Click ํจ์ ์์ฑ*/
private void button1_Click_1(object sender, EventArgs e)
{
/*MessageBox์ Show ์ฌ์ฉํด Hello World ์ถ๋ ฅ */
MessageBox.Show("Hello World");
}
private void Form1_Load_1( object sender, EventArgs e)
{
//TextBox์ ์ด๊ธฐ๊ฐ ํ ๋น
textBox1.Text = "์์ธํน๋ณ์ ์๋ฑํฌ๊ตฌ ์ ๊ธธ๋ 123๋ฒ์ง";
StringBuilder sb = new StringBuilder();
sb.AppendLine("์ด๋ฆ : ํ๊ธธ๋");
sb.AppendLine("๋์ด : 27์ธ");
sb.AppendLine("๊ตญ์ : ํ๊ตญ");
textBox2.Text = sb.ToString();
/*์ต๋ ๊ธธ์ด ์ง์ */
textBox3.MaxLength = 10;
/*์ฝ๊ธฐ๋ง ๊ฐ๋ฅ */
textBox4.ReadOnly = true;
/* PasswordChar ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ฐ๋๋ค*/
textBox5.PasswordChar = '*';
textBox3.Text = "์์ธํน๋ณ์ ์๋ฑํฌ๊ตฌ ์ ๊ธธ๋ 123๋ฒ์ง";
textBox4.Text = "์์ธํน๋ณ์ ์๋ฑํฌ๊ตฌ ์ ๊ธธ๋ 123๋ฒ์ง";
textBox5.Text = "์์ธํน๋ณ์ ์๋ฑํฌ๊ตฌ ์ ๊ธธ๋ 123๋ฒ์ง";
}
}
} `