본문 바로가기

컴퓨터

[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.. 더보기
[Visual Studio 2005/C# 애러] Visual Studio cannot start debugging because the debug target.. Visual Studio cannot start debugging because the debug target....is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly. ------------------------------------------------------------------------------ 이 애러 발생시.. Properties에서 삽질로 계속 수정 해봤지만, 해결되지 않음..ㅠ 역시나 재설치를 하는게 제일 빠르게 해결됨...! 문제는 V.. 더보기
[C#] 숫자만 입력 받는 코드, 문자 입력시 대문자 자동 변환 코드 //////////////////////////////////////////////////////////////////////////////////////////////////////// C# 텍스트박스에서 숫자만 입력 가능하게 하는 코드 KeyPress 이벤트 핸들러 메서드에 아래 구문을 넣는다. 숫자키와 Backspace키만 유효 함 if(!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back))) { e.Handled = true; } //////////////////////////////////////////////////////////////////////////////////////////////////////// ComboBox.. 더보기
[C#] 파일입출력을 위한 클래스 using System.IO; // 선언이 필요 클래스 설명 BinaryReader 기본 데이터 형식을 특정 인코딩의 이진 값으로 읽습니다. BinaryWriter 기본 이진 형식을 스트림에 쓰고 특정 인코딩으로 된 문자열 쓰기를 지원합니다. BufferedStream 다른 스트림에 대한 읽기 및 쓰기를 수행합니다. Directory 디렉터리 이동,복사,삭제 위한 클래스 입니다. DirectoryInfo 디렉터리 생성 및 디렉토리를 조작하는 여러 메서드를 제공하는 클레스입니다. DirectoryNotFoundException 파일이나 디렉터리의 일부를 찾을 수 없을 때 throw되는 예외입니다. EndOfStreamException 읽을 때 throw되는 예외가 스트림의 끝을 지나 시도됩니다. Error.. 더보기