라벨이 WinForm인 게시물 표시

About Box for WinForm

윈폼용 About Box. 굿~

Persisting and Restoring Application State

Isolated Storage A standard Windows application can have full access to the computer (depending on user security settings), so there are many options for storing data, such as using the Windows Registry or the local file system. But an attractive alternative to these classic approaches is to use the .NET Framework’s isolated storage technology. Besides being easy to use, the same techniques work in all environments in which managed code can run, such as in a Silverlight application or a XAML Browser Application (covered later in this chapter). For desktop apps, isolated storage is a data storage mechanism that provides isolation and safety by defining standardized ways of associating code with saved data. Standardization provides other benefits as well. Administrators can use tools designed to manipulate isolated storage to configure file storage space, set security policies, and delete unused data. With isolated storage, your code no longer needs unique paths to specify safe locat...

Form의 Close() 와 Dispose() 호출.

Form.Close() sends the proper windows messages to shut down the win32 window. During that process, if the form was not shown modally, Dispose is called on the form. Disposing the form frees up the unmanaged resources that the form is holding onto.   If you do a form1.Show() or Application.Run(new Form1()), Dispose will be called when Close() is called. However, if you do form1.ShowDialog() to show the form modally, the form will not be disposed, and you'll need to call form1.Dispose() yourself.  I believe this is the only time you should wor...

윈폼에서 폼의 모든 컨트롤의 데이타바인딩 제거하는 방법.

//익셉션 발생 dataTable.Rows[0].Delete(); public void clearAllBindings(){ CurrencyManager cm = this.BindingContext[dataTable] as CurrencyManager; cm.Bindings.Cast<Binding>().ToList().ForEach(b => b.Control.DataBindings.Clear()); } //괜찮음. dataTable.Rows[0].Delete(); 윈폼에서 DataSource로 데이타테이블을 사용하는데, 현재 컨트롤들에 바인딩된 행이 만약 지워지면, 컨트롤의 DataBinding 에서 에러를 뿜는다. 컨트롤에서야 당연히 DataSource가 유효할 것으로 생각하는데, 현재 행이 지워져버렸기 때문. 따라서 컨트롤에서 사용 중인 행을 꼭 지워야 하는 상황이라면, 미리 모든 바인딩을 삭제해야 한다. 해당 컨트롤 별로 컨트롤.DataBindings.Clear()를 호출할 수도 있으나, 위의 코드가 더 깔끔. 물론 각 컨트롤의 DataBinding에서 소스를 읽을 때 처리해줘도 된다. 찾아보길. 원문