hi!
for many times i needed a code for datagrid to show a progressbar while
reading data from a database (*.mdb).
now i think if my form reads data from database one by one and then puts
them in datagrid row by row will solve this idea.
because progressbar min is 0 and the max is set to count of records in the
table in my database.
then as the program is reading records and adds them to datagrid, one unit
is added to progressbar until becomed quite full.
now what i need is a code for reading records from tblcustomers in databse
and putting them in datagrid1 row by row.
Database: database1.mdb
Table: TblCustomers
the table has 4 fields: ID,cust_name,Cust_city,Cust_State
form: frmCustomers
datagrid: datagrid1
i welcime any codes or samples
Bset wishes
Kourosh - 13 Jun 2005 20:34 GMT
> hi!
> for many times i needed a code for datagrid to show a progressbar while
[quoted text clipped - 16 lines]
> i welcime any codes or samples
> Bset wishes
check fill method, you can find your answer.
DCraig - 14 Jun 2005 23:52 GMT
Here's an example that might help - the other poster suggested using the
fill method but you asked for a row by row method so you can update your
progress bar.
Note: cn is a sql connection, rdr is an sql datareader, idxLanguagCode and
languageName are integers that retrieve the data by position in the results
coming back from SQL Server. tblLanguages is a datatable, the sql select
statement was used to instantiate the command.
'Open connection, execute the reader,
'then loop through the result set and
'count the found values setting i.
cn.Open()
rdr = cmd.ExecuteReader()
While rdr.Read
rw = Me.tblLanguages.NewRow()
rw("language_code") = rdr.GetString(idxLanguageCode)
rw("language_name") = rdr.GetString(idxLanguageName)
tblLanguages.Rows.Add(rw)
i += 1
End While
hth;
DCraig.
> hi!
> for many times i needed a code for datagrid to show a progressbar while
[quoted text clipped - 16 lines]
> i welcime any codes or samples
> Bset wishes