Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
For A As Integer = 0 To DataGridView2.Rows.Count - 1
For B As Integer = A + 1 To DataGridView2.Rows.Count - 2
If DataGridView2.Rows(A).Cells(1).Value = DataGridView2.Rows(B).Cells(1).Value Then
DataGridView2.Rows.RemoveAt(B)
A -= 1
End If
Next
Next
End Sub
ลองนำไปใช้งานดูนะครับ
Tag : .NET, Ms SQL Server 2008, Crystal Report, Win (Windows App), VB.NET
Dim DS As New DataSet
Dim Ap As New SqlClient.SqlDataAdapter("Select Case DISTINCT Country FROM Customers;", "Data Source=server\sqlexpress;Initial Catalog=sps_trace;User ID=12345;Password=12345")
Ap.Fill(DS)
GridView1.DataBind()