본문 바로가기

씨샵10

[c#] TextBox MultiLine 삭제방법 TextBox MuliLine을 사용시 특정 행까지만 표시하고 싶은경우가 있습니다. 아래 예제에서는 24행까지만 Textbox에 표시하고 이후부터는 첫번째 행을 삭제하는 로직 입니다. 1 2 3 4 5 6 7 if (tbxInHist.Lines.Length > 25) { int index = tbxInHist.Text.IndexOf(Environment.NewLine); tbxInHist.Text = tbxInHist.Text.Remove(0, index + 2); } this.tbxInHist.Text += String.Format("[{0}] {1}\r\n", DateTime.Now, barcode); cs 2021. 1. 13.
C# Linq Where 사용법(DataTable) DataTable을 사용한 Linq Where절 사용방법 입니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 //검색조건 String _SelectValue = "P01"; //Linq Where절 var query = from order in _dtSource.AsEnumerable() where order.Field("PBOXID") == _SelectValue select new { BAR_CD = order.Field("BAR_CD"), ITEM_NM = order.Field("ITEM_NM"), CNT = order.Field("CNT"), CREATE_DT = order.Field("CREATE_DT") }; //그리에 DataSource RGrid.DataSo.. 2021. 1. 8.
C# Linq Group By 사용법(DataTable) DataTable을 사용하여 Linq Group By 사용방법 입니다. 1234567891011121314151617181920 //Data 조회 _dtSource = Query.GET_MAP_HIS(); //Linq Group by var query = from order in _dtSource.AsEnumerable() group order by new { PBOXID = order.Field("PBOXID"), P_MODE = order.Field("P_MODE") } into g select new { PBOXID = g.Key.PBOXID, P_MODE = g.Key.P_MODE }; //Linq to Arry변화하여 그리드 DataSource 할당 LGrid.DataSource = query... 2021. 1. 8.
외부응용프로그램 실행하기 (Process.Start 메서드) 윈도우를 종료 System.Diagnostics.Process.Start("cmd.exe","ShutDown.exe -s -f -t 00"); 윈도우를 재부팅 System.Diagnostics.Process.Start("cmd.exe","ShutDown.exe -r -f -t 00"); 특정 폴더 열기 System.Diagnostics.Process.Start("explorer.exe", "C:\\Temp"); 특정 사이트 열기 System.Diagnostics.Process.Start("explorer.exe", "http://www.naver.com"); 도스명령어 실행 System.Diagnostics.Process.Start("cmd.exe","dir"); //위의 dir 부분에 도스 명령어를 쳐.. 2010. 12. 21.