كود :
Dim c, t As Integer
DataGridView2.Columns.Clear()
For t = 0 To DataGridView1.Columns.Count - 1
DataGridView2.Columns.Add(DataGridView1.Columns(t).Clone())
Next
For c = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(c).Cells(4).Value = True Then
DataGridView2.Rows.Add(DataGridView1.Rows(c).Cells(0).Value, DataGridView1.Rows(c).Cells(1).Value)
DataGridView2.Columns(2).Visible = False
DataGridView2.Columns(3).Visible = False
End If
Nextأو
كود :
Dim c, t As Integer
DataGridView2.Columns.Clear()
For t = 0 To DataGridView1.Columns.Count - 1
DataGridView2.Columns.Add(DataGridView1.Columns(t).Clone())
Next
For c = 0 To DataGridView1.Rows.Count - 1
If Not IsDBNull(DataGridView1.Rows(c).Cells(3).Value) Then
DataGridView2.Rows.Add(DataGridView1.Rows(c).Cells(0).Value, DataGridView1.Rows(c).Cells(1).Value, DataGridView1.Rows(c).Cells(2).Value, DataGridView1.Rows(c).Cells(3).Value)
' DataGridView2.Columns(2).Visible = False
' DataGridView2.Columns(3).Visible = False
End If
Nextطبعاً كل الشكر ل ameerah لأني أستفدت من الكود في شغله ثانية
