본문 바로가기

C# Winform26

C# Winform | List Sort | ObservableCollection Sort C# Winform | List Sort | ObservableCollection Sort List Sort Code - 1 List orgList = new List(); List tempList = orgList.OrderBy(x => x.FiledName).ToList(); cs Code - 2 List orgList = new List(); orgList.Sort(delegate (classObjectx, classObjecty) { if (x.FiledName == null && y.FiledName == null) return 0; else if (x.FiledName == null) return -1; else if (y.FiledName == null) return 1; else retur.. 2020. 7. 3.
C# Winform | enum foreach C# Winform | enum foreach enum foreach foreach (sample_t p in Enum.GetValues(typeof(sample_t))) { Console.WriteLine(p.ToString() + " : " + (int)p); } Colored by Color Scripter cs TEST CODE - 1 public enum sample_t { SAMPLE1, SAMPLE2, SAMPLE3, SAMPLE4, } cs output SAMPLE1 : 0 SAMPLE2 : 1 SAMPLE3 : 2 SAMPLE4 : 3 TEST CODE - 2 public enum sample_t { SAMPLE1 = -100, SAMPLE2, SAMPLE3, SAMPLE4, } cs o.. 2020. 5. 6.
C# Winform | Hardware Info | CPU ID, HDD, Mac, Serial C# Winform | Hardware Info | CPU ID, HDD, Mac, Serial using System.Management MSDN MSDN Computer System Hardware Classes - Win32 apps Computer System Hardware Classes In this article --> The Computer System Hardware category groups classes together that represent hardware related objects. Examples include input devices, hard disks, expansion cards, video devices, networking devices, and docs.mic.. 2020. 4. 29.
C# Winform | DateTime Convert(Long To, TimeStamp to) C# Winform | DateTime Convert(Long To, TimeStamp to) long Date to DateTime private DateTime LongDateToDateTime(long longdate, string type) { DateTime date = DateTime.ParseExact(longdate.ToString(), type, System.Globalization.CultureInfo.InvariantCulture); return date; } Colored by Color Scripter cs TEST CODE private void button1_Click(object sender, EventArgs e) { Console.WriteLine(LongDateToDat.. 2020. 4. 28.
C# Winform | properties settings 저장 C# Winform | properties settings 저장 .NET Framework 2.0부터 수 만들고 응용 프로그램 실행 세션 간에 유지 되는 값에 액세스 합니다. 이러한 값 이라고 설정을합니다. 응용 프로그램의 중요 한 정보를 사용 해야 합니다. 또는 설정에는 사용자 기본 설정에 나타낼 수 있습니다. 예를 들어 일련의 응용 프로그램의 색 구성표에 대 한 사용자 기본 설정을 저장 하는 설정 만들 수 있습니다. 또는 응용 프로그램을 사용 하는 데이터베이스를 지정 하는 연결 문자열을 저장할 수 있습니다. 설정을 코드 외부에 있고 개별 사용자의 기본 설정을 저장 하는 프로필을 만드는 응용 프로그램에 중요 한 정보를 유지 하 둘 다를 수 있습니다. 설정 1. [프로젝트 탐색기]에서 Properties.. 2020. 3. 5.
C# Winform | cross thread - InvalidOperationException C# Winform | cross thread - InvalidOperationException cross thread의 원인 WinForm은 그 UI 컨트롤을 생성한 쓰레드만(UI 쓰레드)이 해당 UI 객체를 엑세스할 수 있다는 쓰레드 선호도(Thread Affinity) 규칙을 지키도록 설계되었다. 만약 개발자가 이러한 기본 규칙을 따르지 않는다면, 에러가 발생하거나 예기치 못한 오동작을 할 수 있다. UI 컨트롤을 생성하고 이 컨트롤의 윈도우 핸들을 소유한 쓰레드를 UI Thread라 부르고, 이러한 UI 컨트롤들을 갖지 않는 쓰레드를 작업쓰레드 (Worker Thread)라 부른다. 일반적으로 UI 프로그램은 하나의 UI Thread (주로 메인쓰레드)를 가지며, 여러 개의 작업 쓰레드를 갖는다... 2020. 3. 2.