F
Fred Iannon
All,
Please consider the following scenario:
I have a listbox with a number of employee names as part
of a larger form which contains data about those employees.
If the user selects a new employee from the listbox, I
would like to prompt them to save/delete/"cancel the
operation" for any data changes which were made to the
previously edited employee. IF they press "cancel" I want
to PREVENT the listbox index change from occuring.
Is there a good way to do this? I need to be able to
cancel the event, however once I have received the
SelectedIndexChanged event it is to late, and I canNOT
find another event that gives me a chance to cancel the
index change before it happens (like a Validating event
PER listbox entry....)
I know this sounds like schoolwork, but it is not <LOL> I
really liked .NET forms at first (as compared to MFC),
however as I started using them for real-life applications
IMHO there are still a number of "common" problems (like
this one) that do not seem to be readily solvable without
trickery....(previously I posted about some shortcomings
with the Validating event and, IMHO, the keypress event
also has some definite room for improvement since you
canNOT necessarily tell what the "new" text will be until
AFTER it has already been populated...consider
cut/paste/highlighted selections, etc....)
Thanks for any help,
Fred Iannon
Please consider the following scenario:
I have a listbox with a number of employee names as part
of a larger form which contains data about those employees.
If the user selects a new employee from the listbox, I
would like to prompt them to save/delete/"cancel the
operation" for any data changes which were made to the
previously edited employee. IF they press "cancel" I want
to PREVENT the listbox index change from occuring.
Is there a good way to do this? I need to be able to
cancel the event, however once I have received the
SelectedIndexChanged event it is to late, and I canNOT
find another event that gives me a chance to cancel the
index change before it happens (like a Validating event
PER listbox entry....)
I know this sounds like schoolwork, but it is not <LOL> I
really liked .NET forms at first (as compared to MFC),
however as I started using them for real-life applications
IMHO there are still a number of "common" problems (like
this one) that do not seem to be readily solvable without
trickery....(previously I posted about some shortcomings
with the Validating event and, IMHO, the keypress event
also has some definite room for improvement since you
canNOT necessarily tell what the "new" text will be until
AFTER it has already been populated...consider
cut/paste/highlighted selections, etc....)
Thanks for any help,
Fred Iannon