Friend Function DataGridrows(ByVal dg As DataGrid) As Integer Dim strFoo As String ' Disposable Dim iCount As Integer Try For iCount = 0 To 50000 strFoo = dg.Item(iCount, 0).ToString Next Catch ex As Exception Return (iCount) End Try End FunctionHTH,
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Static start_time As DateTime Static stop_time As DateTime Dim elapsed_time As TimeSpan start_time = Now Me.Text = DataGridrows(DataGrid1) stop_time = Now elapsed_time = stop_time.Subtract(start_time) Me.Text &= " " & elapsed_time.TotalSeconds.ToString("0.000000") End Sub Friend Function DataGridrows(ByVal dg As DataGrid) As Integer Dim strFoo As String Dim iCount As Integer Try For iCount = 0 To 50000 strFoo = dg.Item(iCount, 0).ToString Next Catch ex As Exception Return (iCount) End Try End Function Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load BindTableToDataGrid() End Sub Public Sub BindTableToDataGrid() Dim dt As New DataTable dt.Columns.Add(New DataColumn("Item", GetType(String))) dt.Columns.Add(New DataColumn("Color", GetType(String))) For x As Integer = 1 To 25000 dt.Rows.Add(New String() {"table", "brown"}) dt.Rows.Add(New String() {"chair", "white"}) Next DataGrid1.DataSource = dt End Sub
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams