|
-
Jan 6th, 2004, 04:44 PM
#1
Thread Starter
Frenzied Member
Combobox change events [Resolved]
I have two comboboxes that are populated from a table (projects), in one case, and just adding items in another (months). The user can navigate through existing records and just view the data. Or, if they want, they can change the data, i.e. select a different project or month and save the changes. That works fine.
But say the user makes a change, forgets to save it, and clicks the button to move to the next or previous record. I want to prompt them to save the change, if they want.
The problem is that each time they advance or go back through the records, even if only viewing, the prompt comes up. I checked for a change in data in SelectedIndexChanged, but that fires when the record changes. Then I tried Click, but apparently that fires as well whenever the record changes.
Is there a way to only trap a change when the user actually changes it, not automatic events? Thanks.
Last edited by salvelinus; Jan 7th, 2004 at 11:40 AM.
-
Jan 6th, 2004, 08:48 PM
#2
Frenzied Member
Are the controls data bound?
-
Jan 7th, 2004, 08:19 AM
#3
Thread Starter
Frenzied Member
-
Jan 7th, 2004, 11:44 AM
#4
Thread Starter
Frenzied Member
Solved the question this way:
VB Code:
Private Sub cboProject_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cboProject.MouseDown, _
cboMonth.MouseDown
mblnMouseDown = True
End Sub
Private Sub cboProject_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cboProject.MouseUp, _
cboMonth.MouseUp
If mblnMouseDown Then
mblnDataChanged = True
mblnMouseDown = False
End If
End Sub
The Click event wasn't firing, I'd forgotten to take the flag out of SelectedIndexChanged. The Click event fires when the user clicks on the down arrow, though, not a selection, so it didn't work either.
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
|