본문 바로가기

컴퓨터/언어,프로그래밍

[C#] progress bar 사용하기 The Progressbar class provides progress bar control functionality in the .NET framework. You need progress bars to display the progress of your application or background tasks. There are only three members of the ProgressBar class you should know about. The Maximum, the Minimum, and the Value properties. You create a progress bar control using ProgressBar constructor. this.progressBar1 = new Sys.. 더보기
[C#] 부모창에서 자식창으로 값 넘기는 방법(소스) [부모창] Form1.cs에서 private void menuAToolStripMenuItem_Click(object sender, EventArgs e) { Form2 ff = new Form2(1); ff.Show(); } private void menuBToolStripMenuItem_Click(object sender, EventArgs e) { Form2 ff = new Form2(2); ff.Show(); } [자식창] Form2에서 private int type; public Form2(int select) { type = select; InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if( t.. 더보기
[C#] 자식창에서 부모창으로 값 넘기는 방법(소스) [첫번째 방법] 1) 부모창에서 자식창을 불러오는 곳에서 public String temp = ""; private void button3_Click(object sender, EventArgs e) { frmParent fChild = new frmParent(); fChild.Owner = this; fChild.ShowDialog(); //fChild.ShowDialog(this); } 2) 자식창에서 값을 넘길 때 private void button1_Click(object sender, EventArgs e) { ((frmParent)(this.Owner)).temp = textBox1.Text; } frmParent(부모창)에서의 temp는 public으로 선언 되어 있어야 frmChild(자.. 더보기
Excel ODBC http://www.codeproject.com/KB/database/cspreadsheet.aspx 더보기
[프로그래밍] 상속의 이유 동물이란 범주에서 생각해보자호랑이란 Class가 있으며, 토끼란 Class가 있다.Class 호랑이{int 동물 종류;int 무게;bool 성별;int 특징;}Class 토끼{int 동물 종류;int 무게;bool 성별;int 습성;}토끼와 호랑이는 같은 동물이다라는 공통점이 있다. 똑같은 변수를 호랑이 Class에서 사용하고 토끼 Class에서 사용하고 있다.Class 동물{int 동물 종류;int 무게;bool 성별;동물 (int _동물 종류, int _무게, bool _성별){동물 종류 = _동물 종류;무게 = _무게;성별 = _성별;}}이 동물이라는 Class를 공통점으로 갖으면 된다.그리고Class 호랑이 : public 동물{int 특징;호랑이(int _동물 종류, int _무게, bool _.. 더보기
[C#] 콘솔 입출력 코드 namespace ConsoleApplication1 { class Hello { static void Main(string[] args) { string strRead; int i = 0; Console.WriteLine("이름을 넣어주세요 ->"); strRead = Console.ReadLine(); while (strRead.Length != 0) { i++; Console.WriteLine("안녕하세요 ? {0}!!", strRead + "님...."); Console.WriteLine("{0}", i.ToString() + "번째 손님입니다."); Console.Write("이름을 넣어주세요 ->"); strRead = Console.ReadLine(); if (strRead == "q") {.. 더보기
[C#] 파일 쓰기, 복사, 삭제, 이동 class Program { static void Main(string[] args) { string MyWriteFile3 = @"Data.txt"; Console.WriteLine("파일 생성중.... 잠시만 기다리세요."); StreamWriter FileWriter3 = File.CreateText(MyWriteFile3); Console.WriteLine("파일에 데이터 작성중...."); FileWriter3.WriteLine("== File Name = FilePorcess3.txt =="); FileWriter3.WriteLine("안녕하세요!!!"); FileWriter3.WriteLine("수고하세요 저장합니다."); FileWriter3.Close(); Console.WriteLine.. 더보기
[C#] 숫자만 입력 받는 코드, 문자 입력시 대문자 자동 변환 코드 //////////////////////////////////////////////////////////////////////////////////////////////////////// C# 텍스트박스에서 숫자만 입력 가능하게 하는 코드 KeyPress 이벤트 핸들러 메서드에 아래 구문을 넣는다. 숫자키와 Backspace키만 유효 함 if(!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back))) { e.Handled = true; } //////////////////////////////////////////////////////////////////////////////////////////////////////// ComboBox.. 더보기