By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Event question ?

P: n/a
As the user input the customercode, I will check the customercode is valid
or not in "validateded event". Well, as the user save the invoice, I would
like to do the validation again.

it seems too dummy that I write another same code about this. Can I re-user
the validated event" ?
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Agnes,

In my opinion it is the nicest to make something as this

myvalidate event
doValidating

myclosing event
doValidating

private sub doValidating
......

However there are very much other solutions, and I can not say I do this
myself forever.

I hope this helps?

Cor
As the user input the customercode, I will check the customercode is valid
or not in "validateded event". Well, as the user save the invoice, I would
like to do the validation again.

it seems too dummy that I write another same code about this. Can I re-user the validated event" ?

Nov 20 '05 #2

P: n/a
In my old vfp application, I use the same concept as U.
I got 10 textboxes to be validated, I will call another event to check the
data again.
I am wonder whether .net got another solution (I thought my old ways in vfp
are too stupid)
But now, i think I know how to design the validated flow
Thanks

"Cor Ligthert" <no**********@planet.nl> bl
news:e2**************@TK2MSFTNGP10.phx.gbl g...
Hi Agnes,

In my opinion it is the nicest to make something as this

myvalidate event
doValidating

myclosing event
doValidating

private sub doValidating
.....

However there are very much other solutions, and I can not say I do this
myself forever.

I hope this helps?

Cor
As the user input the customercode, I will check the customercode is valid or not in "validateded event". Well, as the user save the invoice, I would like to do the validation again.

it seems too dummy that I write another same code about this. Can I

re-user
the validated event" ?


Nov 20 '05 #3

P: n/a
Hi Agnes,

There are other methods I said. This is the most easy one. However needs
some typing, you can also add an event to an array of your textboxes and
than use a select case in that "doValidating" depending on the sender (which
can as well be the close)

I hope this helps?

Cor
Nov 20 '05 #4

P: n/a
Agnes,
I got the following tip from "Windows Forms Programming in C#" by Chris
Sells, from Addison Wesley.

Within your "Accept" button click handler (the "save" button) process each
control that CausesValidation to ensure that they are all valid...

Something like:

For Each control As control In Me.Controls
If control.CausesValidation Then
control.Focus()
If Not Me.Validate() Then
Me.DialogResult = DialogResult.None
Exit For
End If
End If
Next

Note this version does not validate controls nested within other container
controls, such as GroupBoxes, I would include the above in a recursive
subroutine.

The above code will cause the Validating event for each of your controls to
be raised, ensuring that all the controls get validated, before the dialog
is closed or the data is saved...

Hope this helps
Jay
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:OF**************@TK2MSFTNGP10.phx.gbl...
As the user input the customercode, I will check the customercode is valid
or not in "validateded event". Well, as the user save the invoice, I would
like to do the validation again.

it seems too dummy that I write another same code about this. Can I re-user the validated event" ?

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.