Dialog Box

J

Jim Heavey

Hello, I am trying to create my own little dialog box. Prior to returning, I
want to ensure the information keyed in my dialog box is correct. If not
correct, then the user must correct or cancel out of the dialog box.

I set the "Cancel" button "DialogResult" property to cancel. The other button
I set the DialogResult property to OK, BUT ONLY AFTER IT PASSES THE
VALIDATION. Evidently this property has to be set prior to the button being
clicked and if set within the button click event then requires the button to
be clicked again.

I thought I would create a hidden button and set it DialogResult Property to
"OK" and then raise the event within the other buttons click event after I
determined that all the edits had been passed. When I enter the "RasieEvent
cmdExit.Click (sender, e)" the editor does not like it and says cmdExit is not
an event within the class.

So can I not raise another buttons click event?

Is there a better technique for doing this?

Thanks in advance for your assistance!!!!!!!!!!
 
N

Nak

Hi Jim,

Make a standard button, don't set it's dialog result though. Run your
validation code and when you want to return an OK result, use

Me.DialogResult = DialogResult.OK

Okay?

Nick.
 
J

Jim Heavey

That worked just fine...

Thanks!!!!!!!

Nak said:
Hi Jim,

Make a standard button, don't set it's dialog result though. Run your
validation code and when you want to return an OK result, use

Me.DialogResult = DialogResult.OK

Okay?

Nick.
 
J

Jim Heavey

Thanks
Nak said:
Hi Jim,

Make a standard button, don't set it's dialog result though. Run your
validation code and when you want to return an OK result, use

Me.DialogResult = DialogResult.OK

Okay?

Nick.
 
N

Nak

No probs Jim.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top