Is it safe to assume that the code for you ListView is in a public sub or function? If so, then in Form B's FormClosing event or FormClosed, just call the sub or function.
Let's assume your sub's name is: ListViewSub
So, unless I'm mistaken, you can do something like this:
vb Code:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Is it safe to assume that the code for you ListView is in a public sub or function? If so, then in Form B's FormClosing event or FormClosed, just call the sub or function.
Let's assume your sub's name is: ListViewSub
So, unless I'm mistaken, you can do something like this:
vb Code:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
FormA.ListViewSub()
End Sub
Thanks bro,
vb Code:
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim SREForm As New frmSRE
SREForm.InitializeListView()
End Sub
I had used this method before, but the listview still retain old value.
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
In your code, you're declaring the form with a variable, and then calling the Sub. It doesn't retain the value because when the form closes, it disposes of the variable.
Try just calling the second form with it's actual name:
vb Code:
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
frmSRE.InitializeListView()
End Sub
If that doesn't work, then I'll probably need to know some more information about how how you want to update your list and with what type of information.
Last edited by weirddemon; Sep 14th, 2009 at 04:26 AM.
I'm uploading a test project on what I suggested. So hopefully there's no confusion on what I recommended you do. Look at that example, and if that isn't what you're trying to do, then I'll need to know some more information.
Hmm... I'm not entirely sure. I know VS 2003 utilizes an older .NET Framework. However, that shouldn't matter with what you're doing. Could you post the exact code you're using?
Also, when it does error, does the compiler point to a specific line? If so, which line?
Hmm... I'm not entirely sure. I know VS 2003 utilizes an older .NET Framework. However, that shouldn't matter with what you're doing. Could you post the exact code you're using?
Also, when it does error, does the compiler point to a specific line? If so, which line?
Form A
vb Code:
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim SREForm As New frmSRE
SREForm.InitializeListView()
End Sub
To this:
vb.net Code:
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
frmSRE.InitializeListView()
End Sub
That should work. It's what I said from the beginning. I only tested it with the InitializeListView sub. I wasn't able to test it with the other because I don't have access to your db.
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim SREForm As New frmSRE
SREForm.InitializeListView()
End Sub
To this:
vb.net Code:
Private Sub frmSREDetails_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
frmSRE.InitializeListView()
End Sub
That should work. It's what I said from the beginning. I only tested it with the InitializeListView sub. I wasn't able to test it with the other because I don't have access to your db.
It should still work though.
Thanks bro,
I had tested this method and revert the output at thread #5.
I would hit the error (reference to a non-shared requires an object references ) if I didn't declared object.
FYI : I open form B by using showdialog() instead of .show()
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.