G
Guest
Hi, I'm refreshing a panel based on a selection from a winforms combobox.
In my _SelectedIndexChanged event for the combobox, if changes to the
panel's controls are present I am checking the response from a messagebox to
proceed using MsgBoxStyle.YesNoCancel.
When clicking cancel on the messagebox, is there a way to have the combobox
rejected the changed index and revert back to the previous selection without
setting the selectedItem? Currently getting circular references when doing
that.
Code:
Private Sub cboPage_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cboPage.SelectedIndexChanged
If Not CInt(sender.SelectedItem.Value) <> _currentSetMax Then
If ItemsModified Then
Select Case MsgBox("Changes have been made, Save changes?",
MsgBoxStyle.YesNoCancel, "Items Changed")
Case MsgBoxResult.Yes
' TO DO: Save the existing controls in the panel
Case MsgBoxResult.Cancel
'TO DO: Reset the cboPage to the previous selection and return
Return
End Select
End If
' TO DO: Refresh the controls in the panel
End If
End Sub
Thanks!
In my _SelectedIndexChanged event for the combobox, if changes to the
panel's controls are present I am checking the response from a messagebox to
proceed using MsgBoxStyle.YesNoCancel.
When clicking cancel on the messagebox, is there a way to have the combobox
rejected the changed index and revert back to the previous selection without
setting the selectedItem? Currently getting circular references when doing
that.
Code:
Private Sub cboPage_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cboPage.SelectedIndexChanged
If Not CInt(sender.SelectedItem.Value) <> _currentSetMax Then
If ItemsModified Then
Select Case MsgBox("Changes have been made, Save changes?",
MsgBoxStyle.YesNoCancel, "Items Changed")
Case MsgBoxResult.Yes
' TO DO: Save the existing controls in the panel
Case MsgBoxResult.Cancel
'TO DO: Reset the cboPage to the previous selection and return
Return
End Select
End If
' TO DO: Refresh the controls in the panel
End If
End Sub
Thanks!