dyspgmr

part of my project involves a form containing a listview of members, populated from a database. This form calls another form which adds new members.

Is there a way to refresh the calling form (the form with the listview) without closing the form that adds members. Our goal is to be able to add a new member into the database and see the updated list and still continue to add more members.



Re: Visual Basic General Refreshing the calling form

DMan1

put a reference to the calling form in the form that adds members

Public Class FormWithListView

private AMF as New AddMemberForm(Me)

Public Sub Addmembers()

AMF.Show

end Sub

End Class

Public Class AddMemberForm

Private MyParent as Form

Public Sub New( Byval ParentForm as Form)

MyParent = ParentForm

End Sub

Private Sub AddItem( Byval i as object)

MyParent.Listview1.Add(i)

end sub

end Class

 *** in a databound scenerio you can refresh the listview through the parent reference also






Re: Visual Basic General Refreshing the calling form

dyspgmr

i tried the idea above and applying each statement in the proper format for my application but did not work. Instead of MyParent.Listview1... I tried accessing the Sub I created in FormWithListView to access the database to refresh the dataset with current info and rewrite the listview (RefreshListView()),

I wrote MyParent.RefreshListView()

But the blue squiggly line error description was "RefreshListView is not a member of system.Windows.Forms.Form".

Did I do something wrong We're still using VB.Net 2003 if that makes a difference.





Re: Visual Basic General Refreshing the calling form

dyspgmr

I did have to change the type of Form it referenced.

in the parameter list, i used "Byval FormWithListView as frmFormWithListView" instead of just Form.

dim Myparent as frmFormWithListView

and got it to work.

Thanks DMan