2011-05-12 2 views
0

내 DataGridView가 제대로 작동하지 않습니다. 이 코드는 내 코드이며, 첫 번째 열이 확인란 열인 4 개의 열만 표시하려고합니다.확인란을 선택하고 DataGridview에서 열 제거

 Dim dt_zone As DataTable 
     Dim iCounter As Integer 

     dt_zone = obj_aims_zone.get_row_for_display("", area_id) 
     dvg_selected_group_list.DataSource = Nothing 
     If dt_zone IsNot Nothing Then 
      If dt_zone.Rows.Count > 0 Then 
       dvg_selected_group_list.DataSource = dt_zone 
       For Each row As DataGridViewRow In dvg_selected_group_list.Rows 
        If row.Cells(3).Value.ToString.Equals(group_id) Then 
         row.Cells(check.Index).Value = True 
        End If 
        row.Cells(1).ReadOnly = True 
        row.Cells(2).ReadOnly = True 
        row.Cells(3).ReadOnly = True 
        row.Cells(4).ReadOnly = True 
       Next 
       For iCounter = 1 To 7 
        dvg_selected_group_list.Columns.RemoveAt(5) 
       Next 
      End If 
     End If 
+1

를? –

+0

그리고 dt_zone 데이터 소스에 대해 뭔가를 말할 수 있습니까? 내가 작성한 코드가 아니더라도 코드가 원하는대로 작동해야합니다. –

+0

내 문제는 체크 박스가 체크되지 않았고 내가 제거한 열이 DataGridview에서 dt_zone의 전체 데이터를 보여 주며, 체크 박스 열이있는 열 4 개만 표시하고 싶습니다. – nyizawhan

답변

0

나는이 잠시 전부터 있었는지,하지만 당신이 원하지 않는 열 삭제 쉽게 보일 수있을 것입니다 : 정확하게 당신이 겪고있는 문제가 무엇인지

dataGridView.Columns.Remove("column name") 
관련 문제