Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing a listview control on a form....

Status
Not open for further replies.

fenris

Programmer
May 20, 1999
824
CA
I have a form that contains a listview control. This control is used to display file information, i.e. filename, path, size, etc. Each row of the control is a class (in my case clsFile.cls).

When I double click on an entry in the control it pops up another form where I can edit some of the information. The information was passed from the main form to it by passing a reference to that specific class.
ONce the information is edited and I commit the changes. After commiting the changes I call a refreshLSV sub that refreshes the listview control on the main form, but this doesn't work.

form1:

'lsv is the name of the listview control
private fileList as new collection 'this is loaded with clsFile classes

private sub lsv_dblclick()

for i = 1 to lsv.listitems.count
if lsv.listitems(i).selected then
set myFile = fileList(i)
end if
next i

form2.setFile = myFile 'This is passed by reference
form2.show
end sub

public sub refreshLSV()
dim itmx as listitem
dim myFile as clsFile

lsv.listitems.clear

for each myFile in fileList
set itmx = lsv.listitems.add(,,myFile.getPath)
itmx.subitems(1) = myfile.getName
itmx.subitems(2) = myfile.getSize
next myFile


end sub


form2:

private myFile as clsFile

public property let setFile(byref f as clsFile)
myfile = f
end property

private sub updateChanges()
form1.refreshlsv
unload me
end sub


The code above only includes the components that are causing probelms. What happens, after the update sub is fired on form2, nothing happens on form1, but if I manually click the refresh button on form1, after firing the update sub on form2, which fires the refreshlsv sub on form1
that displays the updates?

any ideas?

Troy Williams B.Eng.
fenris@hotmail.com

 
Where are you calling the refresh sub?

Put the refresh code in the main form's Activate event.

This will ensure the list view refreshes when the sub form is closed.

Regards,
Mokil.
 
I am calling the refresh sub from both forms. The second form is used to edit one entry in the listview control. Once the user is done editing the entry, they click update which saves the changes and is supposed to fire the refreshlsv sub on form1.....
Troy Williams B.Eng.
fenris@hotmail.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top