f_o_o_k_y
asked on
How to create confirmation dialog box with delay OK button?
Hello,
I'm developing windows forms application in VB.net.
I must allow users to delete some records from database but I want to make it really unpleasant :)
So there must be confirmation dialog box with two buttons.
One of them will be OK and the other one will be Cancel ( I decide which is which based on Random number generator :) )
But I want to enable OK button after few seconds for example 5 seconds during this time there will be
OK (5), OK (4) , OK(3) , OK(2), OK(1), OK and now OK button is enabled.
I know how to do this using form and 2 buttons and Timer object.
But how I can return the result (true or false) to the main form?
I want to do something like MsgBox
Please help me with this problem
Best Regards
FooKy
I'm developing windows forms application in VB.net.
I must allow users to delete some records from database but I want to make it really unpleasant :)
So there must be confirmation dialog box with two buttons.
One of them will be OK and the other one will be Cancel ( I decide which is which based on Random number generator :) )
But I want to enable OK button after few seconds for example 5 seconds during this time there will be
OK (5), OK (4) , OK(3) , OK(2), OK(1), OK and now OK button is enabled.
I know how to do this using form and 2 buttons and Timer object.
But how I can return the result (true or false) to the main form?
I want to do something like MsgBox
Please help me with this problem
Best Regards
FooKy
You can use a Timer from (eg the system.threading) class which updates every x seconds the text of the button.
ASKER
Hello,
Maybe I didn't ask question to creally.
I know how to do everything (buttons, cuntdown, random position of OK button) except one thing.
How can I get in main form value from this confirmation form.
Example belowe shows what I want to do but it's with MsgBox .
I need to do this but instead using MsgBox I want to use my frmConfirm.vb
Best Regards
FooKy
Maybe I didn't ask question to creally.
I know how to do everything (buttons, cuntdown, random position of OK button) except one thing.
How can I get in main form value from this confirmation form.
Example belowe shows what I want to do but it's with MsgBox .
I need to do this but instead using MsgBox I want to use my frmConfirm.vb
Best Regards
FooKy
' frmMain.vb
Dim answer As MsgBoxResult
answer = MsgBox("Are you sure?", MsgBoxStyle.YesNo, "Warning!")
If answer = MsgBoxResult.Yes Then
' DELETE FROM DATABASE
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.