|
-
Jan 14th, 2004, 11:20 AM
#1
Thread Starter
Hyperactive Member
Raising an event
I am instantiating a form by double-clicking on a row in a listview control. The values from the listview row are sent to the instantiated form as variables, not as a dataset. My goal is to allow the user to edit and save changes for that record while in the instantiated form and have those changes reflected in the calling form's listview control. I thought raising an event after the save routine to update the calling form's listview control would do the trick. However, it appears that to allow the instantiated form to raise that event the instantiated form cannot be declared in the double-click event of the listview control, where I want it. Is there a way to make changes within the instantiated form and have the listview control on the calling form reflect those changes without destroying either form? Any help would be appreciated.
A cynic knows the price of everything but the value of nothing.
-
Jan 14th, 2004, 11:49 AM
#2
Thread Starter
Hyperactive Member
The answer is to use AddHandler rather than WithEvents.
A cynic knows the price of everything but the value of nothing.
-
Jan 14th, 2004, 02:05 PM
#3
Thread Starter
Hyperactive Member
More specifically, within the calling form I added the following code within the double-click event of the listview control:
Dim MyCallingForm As New MyForm.MyForm()
AddHandler MyCallingForm.ReLoad, AddressOf ReLoad
This way I can call the form every time I double-click a row in the listview control. I also created a routine in the calling form called ReLoad that cleared the listview control and repopulated it with an updated dataset.
Within the form that was called I added:
Event ReLoad() 'in the declaration section
and at the end of the save routine in the form that was called I added:
RaiseEvent ReLoad()
This way after I saved my changes in the instantiated form the listview control would be cleared and updated with new dataset information.
A cynic knows the price of everything but the value of nothing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|