emub
asked on
Passing control back to Parent form
Hi,
I currently have a main form, with a treeview and a listview on it, when data is loaded into the listview I have a progressform displayed which displays the current progress of the listview populate method. There is also a Stop button on the progress form which the user can click to abort the population of the listview.
The way I have it running at the momment is
[code]
Dim oProgress As New frmLoadProgress()
oProgress._MaxValue = Datasource.Table.Row.Count - 1
oProgress.Show()
Dim oRow As Data.DataRow
For Each oRow In Datasource.Table.Rows
'// code to populate Listview
oProgress._IncValue(1) 'Increase progress bar value by 1
If Not oProgress._LoadStatus Then 'If value = false then uses clicked stop button
Exit For
End If
Next
[/code]
In theroy I would loop through each row in the DataSet adding it to the listview, after each row I could increase the progress bar on the oProgress form by 1. I'll Also check a boolean Value to see if the user clicked Stop before loading the next row.
The problem is when I use the oProgress.Show() method to display the progress form control is passed to oProgress and the program stop untill oProgress is closed. Would I need to create a new thread have the other form loaded in another thread? So both forms run simutainously?
I currently have a main form, with a treeview and a listview on it, when data is loaded into the listview I have a progressform displayed which displays the current progress of the listview populate method. There is also a Stop button on the progress form which the user can click to abort the population of the listview.
The way I have it running at the momment is
[code]
Dim oProgress As New frmLoadProgress()
oProgress._MaxValue = Datasource.Table.Row.Count
oProgress.Show()
Dim oRow As Data.DataRow
For Each oRow In Datasource.Table.Rows
'// code to populate Listview
oProgress._IncValue(1) 'Increase progress bar value by 1
If Not oProgress._LoadStatus Then 'If value = false then uses clicked stop button
Exit For
End If
Next
[/code]
In theroy I would loop through each row in the DataSet adding it to the listview, after each row I could increase the progress bar on the oProgress form by 1. I'll Also check a boolean Value to see if the user clicked Stop before loading the next row.
The problem is when I use the oProgress.Show() method to display the progress form control is passed to oProgress and the program stop untill oProgress is closed. Would I need to create a new thread have the other form loaded in another thread? So both forms run simutainously?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@planocz :: thx for the sample code, I think i'd try the progressbar my existing statusbar, I'll have it where the user presses ESC to abort the load. :)