473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How reject proposed value

I have created an event handler for the ColumnChanging event of a grid. I
have code that looks like this

sProposed = EventData.ProposedValue.ToString

My question is this, if the proposed value is something unacceptable, what
is the code for informing the user that such is the case, rejecting the
value and keeping the user on the field till a right value is entered?

Nov 20 '05 #1
4 1157
Hi Woody,

If you have another field in EventData which the event handler can set,
this can inform the method that raises the event whether the ProposedValue has
been accepted or rejected.

Much like Handled in the KeyPressEventArgs of Control.KeyPress, and Cancel
in the CancelEventArgs of Form.Closing.

Regards,
Fergus
Nov 20 '05 #2
Hi Fergus/Woody,

I'm assuming that your event data class derives from System.EventArgs...
Well instead, derive it from System.ComponentModel.CancelEventArgs.

Now, you can pass the 'Cancel' property back up the event chain and if
Cancel = True, don't do any event.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl...
Hi Woody,

If you have another field in EventData which the event handler can set, this can inform the method that raises the event whether the ProposedValue has been accepted or rejected.

Much like Handled in the KeyPressEventArgs of Control.KeyPress, and Cancel in the CancelEventArgs of Form.Closing.

Regards,
Fergus

Nov 20 '05 #3
Apparently my question was more elemental than you understood. The solution
is to throw an exception.

Thank you for your effort.
Nov 20 '05 #4
Hi Woody,

|| Apparently my question was more elemental than you
|| understood. The solution is to throw an exception.
||
|| Thank you for your effort.

Doh! How could I forget the elementals. I'll make a better effort to
understand next time.

;-)

Regards,
Fergus
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Raymond Hettinger | last post by:
Comments are invited on the following proposed PEP. Raymond Hettinger ------------------------------------------------------- PEP: 329
5
by: barnesc | last post by:
I'm revising my vote. Thanks for the responses. I vote against: class foo: @synchronized @types("o,i,i") @author('Chris King')
1
by: C. Titus Brown | last post by:
Hi all, while playing with PBP/mechanize/ClientForm, I ran into a problem with the way htmllib.HTMLParser was handling encoded tag attributes. Specifically, the following HTML was not being...
16
by: G Matthew J | last post by:
http://htmatters.net/htm/1/2005/07/evaling-JSON.cfm This is more or less in response to Mr Crockford's admonition a few months ago, "fork if you must". Ironically, although in that usenet post...
108
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would...
2
by: Richard Cornford | last post by:
Anyone who has taken a look at the online FAQ today may have noticed that I have updated it. The majority of the changes are the updating of broken links and the implementation of that extensive...
14
by: Torbjørn Pettersen | last post by:
A form input where value = viagra is to be rejected using a javascript, but it doesn't work at all. Line 30 and on is where the last attempt to get the code to work is....
3
by: dr | last post by:
I created a basic service using VS2005. Add OnPowerEvent method as detailed on MSDN and return false to a PowerBroadcastStatus.QuerySuspend notification. The service also has set...
5
by: Randy Webb | last post by:
The list below has the current section number, proposed anchor name, and then the current title of that section. Some make sense, some don't. There are a few that don't have proposed anchor names...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.