Philip,
Although I agree with the answer from Bill
Do I give you this sample that I once made. It is a fill from a datatable
with a progressbar. It was often asked. And than when my sample was ready,
it was not asked anymore.
However your question is in it, so I am glad that I can show it.
\\\Needs a progressbar, a button and a datagrid
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New SqlClient.SqlConnection("Server=MyServer;" & _
"DataBase=Northwind; Integrated Security=SSPI")
Dim cmd As New SqlClient.SqlCommand("Select Count(*) from
Employees", conn)
conn.Open()
ProgressBar1.Maximum = DirectCast(cmd.ExecuteScalar, Integer)
ProgressBar1.Step = 1
ProgressBar1.Minimum = 0
cmd.CommandText = "SELECT * FROM Employees"
Dim rdr As SqlClient.SqlDataReader = cmd.ExecuteReader()
Dim dt As DataTable
While rdr.Read
If dt Is Nothing Then
dt = New DataTable
Dim dtschema As DataTable
dtschema = rdr.GetSchemaTable
For Each drschema As DataRow In dtschema.Rows
dt.Columns.Add(drschema("ColumnName").ToString, _
Type.GetType(drschema("DataType").ToString))
Next
End If
ProgressBar1.PerformStep()
Dim dr As DataRow = dt.NewRow
Dim tempObject(dt.Columns.Count - 1) As Object
rdr.GetValues(tempObject) 'did not go in one time
dr.ItemArray = tempObject
dt.Rows.Add(dr)
Threading.Thread.Sleep(500) 'only for showing
End While
DataGrid1.DataSource = dt
rdr.Close()
conn.Dispose()
End Sub
///
I hope this helps a little bit?
Cor