Click here to Skip to main content
15,945,119 members
Please Sign up or sign in to vote.
3.50/5 (4 votes)
See more:

Hi,

I have 2 buttons on the form, SAVE and PRINT. I want the user to click on the SAVE button first to save the current record and then print it. Now, my question is if the user clicks first on the PRINT button before clicking on the SAVE button, I want to alert the user using MessageBox, etc. that the record needs to be saved first (by clicking on the save button). How can I achieve this?.

(I have done the enable and disable operations but it was not accepted by the client. For example, on from_load ... disable print and enable save, and on save_click enable print)

Thanks,

Posted
Updated 25-Aug-09 11:15am
v2

use enable and disable control.

after save make enable

add code Button1.disable

only on new click.

make disable when ur data is saved.

only on new button
 
Share this answer
 

Simplify man....

Delete the Save button & 

Just put some save code in your print button click event. Who cares if it was saved prevously.

If you like you can do the IsDirty test in the code so an uneeded save isn't done.

If you really like the Save button and want to keep it just execute it's click event (the Save button's) in the Print buttons click event.  Errr I think.  Try it.

 
Share this answer
 
i thnk best way to do that to make print buttom is disable
and when the user press save buttom make print buttom enable

assume
print buttom name is : printbut
save buttom name is : savebut

from design make print buttom disable
by form properties " enable :no"

in savebuttom function
printbut.enabled=true;


in print function
{
.....

printbut.enabled=flase;
}
that to make the user do this operation many times
in this way u force user to press save buttom first without need to show messagebox.

if u don't want this way u can use variable its value zero and become one if the user press save buttom
and in print function check this value
good luck
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900