본문 바로가기
300x250

전체 글302

Sqlite에서 DataBase is Lock 으로 인해 DB 내용 수정 불가. SELECT 문으로 조회한 데이터를 객체에 저장을 한 뒤 그 객체의 내용을 수정을 하려 했는데 code 5 Database is lock 이라는 에러가 발생했습니다. 각각의 쿼리를 실행했을 때는 문제 없이 조회도 되고 수정도 되었습니다. 그런데 꼭 같이 실행할 때는 DB에서 lock 이 걸려 데이터 수정이 안됩니다. 왜 그런지 물어보아 알아보니 쿼리 실행 후 종료가 안된 상태에서 다시 다른 쿼리를 실행하려 할 때 Lock이 걸릴 수 있다 하여 코드를 살펴보았습니다. 그래서 처음 찾은 해결책은 SELECT 쿼리를 실행 후 객체에 저장한 뒤 GC.Close(); GC.WaitForPendingFinalizers(); 두 구문을 추가해주니 정상적으로 동작하는 것을 확인했습니다. 다른 방법이 또 있나 찾아보다가.. 2019. 4. 26.
C# / Winform TreeView TreeView의 항목을 체크박스로 변경 및 체크된 항목 삭제하기. this.treeView.CheckBoxes = true; 를 작성하면 TreeView에 출력되는 노드를 체크박스로 변경할 수 있습니다. SelectedNode.Remove()를 사용하여 여러개의 노드를 체크 후 삭제 시도 시 에러 발생합니다. 여러개 항목을 체크 후 삭제 할 때는 별도의 코드를 작성해야 합니다. private List checkedNodes = new List(); #region Form1() /// /// 생성자 입니다. /// public Form1() { InitializeComponent(); this.addButton.Click += addButton_Click; this.deleteButton.Click += deleteButton_Click; this.deleteAllBut.. 2019. 4. 21.
C# / Winform TreeView TreeView의 노드를 추가, 삭제, 전체 삭제하기. 추가 버튼 / 삭제 버튼 / 전체 삭제 버튼을 클릭하여 TreeView의 노드를 추가, 삭제 그리고 전체 삭제를 할 수 있습니다. #region Form1() /// /// 생성자 입니다. /// public Form1() { InitializeComponent(); this.addButton.Click += addButton_Click; this.deleteButton.Click += deleteButton_Click; } #endregion #region addButton_Click(sender, e) /// /// 추가 버튼 입니다. /// /// 이벤트 발생자 입니다. /// 이벤트 인자 입니다. private void addButton_Click(object sender, System.Event.. 2019. 4. 21.
C# / Winform TreeView TreeView 생성하기. Winform에 있는 TreeView 컨트롤을 생성합니다. #region Form1() /// /// 생성자 입니다. /// public Form1() { InitializeComponent(); CreateTreeView(); } #endregion #region CreateTreeView() /// /// 트리뷰를 생성합니다. /// private void CreateTreeView() { this.exampleTreeView.BeginUpdate(); this.exampleTreeView.Nodes.Add("가"); this.exampleTreeView.Nodes[0].Nodes.Add("가-1"); this.exampleTreeView.Nodes[0].Nodes.Add("가-2"); this.ex.. 2019. 4. 21.
DevExpress / Winform GridControl의 DataSource에 객체를 바인딩 할 때 Column의 FieldName과 객체의 속성 값 맞추기. 객체를 GridControl의 DataSource에 바인딩 한 후 컬럼 생성 될때 컬럼의 FieldName과 객체의 속성 값이 일치 해야 GridView에 정상적으로 출력됩니다. FiledName과 일치 하지 않을 경우 출력될 때 빈칸으로 출력이 되는 상황이 발생합니다. 아래와 같은 속성들이 있을 때 각 컬럼의 FieldName과 속성들을 매칭한 코드 입니다. this.listGridView.Columns[0].FieldName = "ID"; this.listGridView.Columns[1].FieldName = "Subject"; this.listGridView.Columns[2].FieldName = "UseYN"; this.listGridView.Columns[3].FieldName = "Crea.. 2019. 4. 20.
DevExpress / Winform GridView Column Header와 출력 될 행의 폰트 변경 하기. Column Header와 행의 폰트를 변경 할 수 있습니다. // 컬럼 헤더 폰트 변경하기. this.listGridView.Appearance.HeaderPanel.Font = new System.Drawing.Font("나눔고딕코딩", 12F, System.Drawing.FontStyle.Regular); // 행 폰트 변경하기. this.listGridView.Appearance.Row.Font = new System.Drawing.Font("나눔고딕코딩", 12F, System.Drawing.FontStyle.Regular); 2019. 4. 20.
DevExpress / Winform SearchControl에 값을 입력하여 CheckedListBoxControl 항목을 필터링 하기. SearchControl에 값을 입력하여 CheckedListBoxControl 항목을 필터링 할 수 있습니다. public partial class Form1 : Form { #region Form1() /// /// 생성자 입니다. /// public Form1() { InitializeComponent(); List item = new List(); for (int i = 0; i < 5; i++) { item.Add(new Sample() { Name = "Sample" + i.ToString() }); } this.checkedListBoxControl1.DataSource = item; this.checkedListBoxControl1.DisplayMember = "Name"; this.che.. 2019. 4. 18.
DevExpress / Winform CheckedListBoxControl 전체 선택 및 전체 선택 해제하기. CheckedListBoxControl 에서 전체 선택 및 전체 선택 해제 하기 입니다. public partial class Form1 : Form { #region Form1() /// /// 생성자 입니다. /// public Form1() { InitializeComponent(); this.checkedListBoxControl1.Items.Add("Check All"); this.checkedListBoxControl1.Items.AddRange(new object[] { "가", "나", "다", "라", "마",}); this.checkedListBoxControl1.ItemCheck += checkedListBoxControl1_ItemCheck; } #endregion #region c.. 2019. 4. 18.
300x250