the progress bar didn't changed when the progresschanged occur of the BackgroundWorker

hi

i have a backgroundworker object on the form and on the dowork event i write the code to fill the dataset like this

PrivateSub BackgroundWorker1_DoWork(ByVal senderAs System.Object,ByVal eAs System.ComponentModel.DoWorkEventArgs)Handles BackgroundWorker1.DoWork

Me.GoodsDetailsTableAdapter.Fill(Me.MS4GM_DBDataSet.GoodsDetails)

e.Result =Me.MS4GM_DBDataSet.GoodsDetails

EndSub

on the progresschanged event of the backgroundworker i write the following to make the progressbar on the form change it's value

PrivateSub BackgroundWorker1_ProgressChanged(ByVal senderAs System.Object,ByVal eAs System.ComponentModel.ProgressChangedEventArgs)Handles BackgroundWorker1.ProgressChanged

ProgressBar1.Value = e.ProgressPercentage

EndSub

-

and on the load event

BackgroundWorker1.RunWorkerAsync()

and the worker report progress is set to true

but the progressbar didn't changed any help will be good

thanks in advance.

[1432 byte] By [seco] at [2007-12-25]
# 1

ohhhh by the the way the data is loaded on the datagridview successfully but i wanna the progressbar to changed when the data is loaded by percent

thanks

seco at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 2
The tableadapter does not report its progress when filling the dataset. The background worker only is seeing 2 lines of code to report progress on.
KenTucker at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 3

thanks for reply man that what i guess

but is there away to load the data with progress

thanks

seco at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 4

One of the DataAdapter's fill method allows you to specify the start record and number of records to load. You can fill dataset a little at a time and update the progressbar as you go.



Dim strConn As String = _
"Server = .\SQLEXPRESS;Database = pubs; Integrated Security = SSPI;"
Dim ds As New DataSet
Dim conn As New SqlConnection(strConn)
Dim cmdCount As New SqlCommand("select count(title) from titles", conn)
Dim da As New SqlDataAdapter("Select * From titles", conn)
Dim intCount As Integer
conn.Open()
intCount = CInt(cmdCount.ExecuteScalar)
conn.Close()
ProgressBar1.Maximum = intCount
For x As Integer = 0 To intCount - 1
ProgressBar1.Value = x
da.Fill(ds, x, 1, "Titles")
Next
DataGridView1.DataSource = ds.Tables("Titles")


KenTucker at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 5

thanks for reply

but what if the number of rows is greater than in32 which is the maximum number for maximum value of the progressbar?

thanks.

seco at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 6
The dataadapter fill method accepts an integer also. I guess this method would not work for you.
KenTucker at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...