2010년 4월 24일 토요일

C# 폼간 메세지 전송

편하기 하기 위해 클래스를 만들자..

//class1
public class Instance
{
    public static string str_name;  
}

이렇게 static 으로 해주어야 값이 초기화 되지 않는다.

//form1
클래스명.str_name = 넣을값;

//form2
public string str;
private void Lend_Load(object sender, EventArgs e)
        {
         str = Instance.str_name;        
        }

이렇게 한후에 전역변수 str 을 마음것 가져다 쓰면 된다

 

 

출처 - http://mrwebi.tistory.com/9

댓글 없음:

댓글 쓰기