1,105,416 Community Members

closing a form and saving

Member Avatar
ng5
Light Poster
42 posts since Dec 2011
Reputation Points: 9 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

i have a form with a listbox. the listbox can be edited (things added/deleted) and when the form is closed i would like the items in the listbox to be saved when the red "x" in the top right corner is clicked

any ideas?

Member Avatar
codeorder
Postaholic
2,027 posts since Aug 2010
Reputation Points: 197 [?]
Q&As Helped to Solve: 390 [?]
Skill Endorsements: 10 [?]
 
-1
 

Use the FormClosing event.

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        '// save code here.
    End Sub
Member Avatar
Phasma
Junior Poster in Training
81 posts since Nov 2008
Reputation Points: 11 [?]
Q&As Helped to Solve: 21 [?]
Skill Endorsements: 3 [?]
 
0
 

Try putting the save code in the Forms FormClosing Event.

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
   'Do Save stuff
  End Sub
Member Avatar
Phasma
Junior Poster in Training
81 posts since Nov 2008
Reputation Points: 11 [?]
Q&As Helped to Solve: 21 [?]
Skill Endorsements: 3 [?]
 
0
 

Thanks for the down vote after I up voted yours> I will remember that for future posts I see of yours

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: