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
LVL 11
f_o_o_k_yAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
f_o_o_k_yConnect With a Mentor Author Commented:
Solution is to set dialogresult property just before closing form.
and in main form use showDialog() instead of show()
0
 
existenz2Commented:
You can use a Timer from (eg the system.threading) class which updates every x seconds the text of the button.
0
 
f_o_o_k_yAuthor Commented:
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
' frmMain.vb
Dim answer As MsgBoxResult
answer = MsgBox("Are you sure?", MsgBoxStyle.YesNo, "Warning!")
If answer = MsgBoxResult.Yes Then
   ' DELETE FROM DATABASE
End If

Open in new window

0
All Courses

From novice to tech pro — start learning today.