Hi,
I have a text control bound to a column that is of type Decimal. I am doing
the validation myself to see if the user typed in something invalid, calling
CancelCurrentEdit and cancelling the validation event.
If the user typed in something that is not a number, such as 'abc', then
doing this works. The old value stored in the data source is popped into the
control.
However, if the user typed in something that is a legal number, but outside
the set of legal values as I have determined, and I try the exact same
thing, the data source retains the old value, but the control is not
refreshed to match the datasource. So if the user types in '11', but due to
business rules this is invalid, and I would like to cancel the edit, the
datasource retains it's previous value, but the input control on the screen
still says '11'.
What is going on here?
Any ideas on how to fix this? Other then manually changing the text of the
control, which I would like to avoid since it will mean reparsing the item,
and committing it as a change to the row - when in fact no change took
place. 11 1979
Marina,
You know that I gladly like to help especially you.
However you are for me very mystorious about the type of control.
I get the idea it is a windowsform datagrid, however I am not sure.
Cor
:) Thanks
I said it was a text control. It happens to be an infragistics
UltraTextEditor, but I dont' think it is related to it being an infragistics
control, as it would have no concept of me trying to deal with a numeric. I
think it is related to the binding being to a DataColumn the datatype of
which is Decimal.
Basically, if what the user entered cannot be interpreted by .net as a
numeric, CancelCurrentEdit puts the old value in the control. However, if
..net can turn what is typed in as a numeric, CancelCurrentEdit leaves it
there for some reason.
Any insights?
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Marina,
You know that I gladly like to help especially you.
However you are for me very mystorious about the type of control. I get the idea it is a windowsform datagrid, however I am not sure.
Cor
Marina,
I ask this because I don't hear you speaking about the binding events, which
seems to me very easy for the problem you describe.
I assume you know them, however you never know.
When you use normal single databinding with the bindingmanager and not a
kind of repeater than you can do everything with it. http://msdn.microsoft.com/library/de...ventsTopic.asp
When you know this already, than I go another route, however when I had not
showed it than it would have been a waste. I have seen more people long time
active in this newsgroups who never saw them until I showed them. (you have
to push on format and parse to see the documentation).
Cor
Yes, I am handling those 2 events already.
In the Parse, I am keeping track of whether or not the value is acceptable.
The value may be unacceptable because it cannot be parsed to a numeric, or
because it is simply a business rule that is making the value not valid.
In the Validate event for the control, I am checking this saved status. If
the value is good, I call EndCurrentEdit. Otherwise I call CancelCurrentEdit
and say e.Cancel=True, to cancel the event and keep the user in the textbox.
Now, if the status of the parse is invalid due to the string not being
parsed to a numeric, CancelCurrentEdit replaces the old value in the
control. If it is due to a business rule, CancelCurrentEdit leaves the
original value in the datasource, but also leaves the 'bad' value in the
control, instead of putting the datasource's value in the control.
Is that a better explanation of my issue?
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Marina,
I ask this because I don't hear you speaking about the binding events, which seems to me very easy for the problem you describe.
I assume you know them, however you never know.
When you use normal single databinding with the bindingmanager and not a kind of repeater than you can do everything with it.
http://msdn.microsoft.com/library/de...ventsTopic.asp
When you know this already, than I go another route, however when I had not showed it than it would have been a waste. I have seen more people long time active in this newsgroups who never saw them until I showed them. (you have to push on format and parse to see the documentation). Cor
Marina,
A little bit to complex now :-)
I think I do this tomorrow.
When you found it, can you message that than?
Cor In the Parse, I am keeping track of whether or not the value is acceptable. The value may be unacceptable because it cannot be parsed to a numeric, or because it is simply a business rule that is making the value not valid.
In the Validate event for the control, I am checking this saved status. If the value is good, I call EndCurrentEdit. Otherwise I call CancelCurrentEdit and say e.Cancel=True, to cancel the event and keep the user in the textbox.
Now, if the status of the parse is invalid due to the string not being parsed to a numeric, CancelCurrentEdit replaces the old value in the control. If it is due to a business rule, CancelCurrentEdit leaves the original value in the datasource, but also leaves the 'bad' value in the control, instead of putting the datasource's value in the control.
Is that a better explanation of my issue?
"Cor Ligthert" <no************@planet.nl> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Marina,
I ask this because I don't hear you speaking about the binding events, which seems to me very easy for the problem you describe.
I assume you know them, however you never know.
When you use normal single databinding with the bindingmanager and not a kind of repeater than you can do everything with it.
http://msdn.microsoft.com/library/de...ventsTopic.asp
When you know this already, than I go another route, however when I had not showed it than it would have been a waste. I have seen more people long time active in this newsgroups who never saw them until I showed them. (you have to push on format and parse to see the documentation). Cor
Ok.
I can fix this, if after CancelCurrentEdit, I just replace the text of the
control with whatever is in the datasource. It just seems like I shouldn't
have to in this case.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl... Marina,
A little bit to complex now :-) I think I do this tomorrow. When you found it, can you message that than?
Cor
In the Parse, I am keeping track of whether or not the value is acceptable. The value may be unacceptable because it cannot be parsed to a numeric, or because it is simply a business rule that is making the value not valid.
In the Validate event for the control, I am checking this saved status. If the value is good, I call EndCurrentEdit. Otherwise I call CancelCurrentEdit and say e.Cancel=True, to cancel the event and keep the user in the textbox.
Now, if the status of the parse is invalid due to the string not being parsed to a numeric, CancelCurrentEdit replaces the old value in the control. If it is due to a business rule, CancelCurrentEdit leaves the original value in the datasource, but also leaves the 'bad' value in the control, instead of putting the datasource's value in the control.
Is that a better explanation of my issue?
"Cor Ligthert" <no************@planet.nl> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Marina,
I ask this because I don't hear you speaking about the binding events, which seems to me very easy for the problem you describe.
I assume you know them, however you never know.
When you use normal single databinding with the bindingmanager and not a kind of repeater than you can do everything with it.
http://msdn.microsoft.com/library/de...ventsTopic.asp
When you know this already, than I go another route, however when I had not showed it than it would have been a waste. I have seen more people long time active in this newsgroups who never saw them until I showed them. (you have to push on format and parse to see the documentation). Cor
No, that doesn't work.
For example, let's say the column starts out at the value 2. Then, someone
enters a 5. This is valid. Before saving the row, the user goes in and
enters 11. Now, 11 is not a valid value. Calling
RejectChanges, sets the value back to 2, instead of back to 5.
The desired behavior, would be for the value to go back to 5. And I can't
call AcceptChanges in between, as then the row would get a state of not
modified, and there would be no way to tell there were any changes to the
row.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:ur**************@TK2MSFTNGP14.phx.gbl... Marina,
Can a datarow.rejectchanges not be the answer on your question. (First copied to get the changed values).
http://msdn.microsoft.com/library/de...angestopic.asp
Just an idea.
Cor
Marina,
I readed it again.
What you want seems to be for me that you want to do the binding again, so
that the correct values from the source are in your control after that all
validating is done and you have corrected the datasource accoording to that.
Is that correct?
Cor
Right.
It does it on its own if the bad value cannot be interpreted as a numeric at
all. But if the value is bad because business rule determine so, then the
control behaves differently.
This is the part I don't understand. The exact same code is executing - just
what the user typed in is different.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:us**************@TK2MSFTNGP10.phx.gbl... Marina,
I readed it again.
What you want seems to be for me that you want to do the binding again, so that the correct values from the source are in your control after that all validating is done and you have corrected the datasource accoording to that.
Is that correct?
Cor
Marina,
I thought that your answer would have been. I have already removed the
binding and added it again.
:-)
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Scott Mueller |
last post by:
I have a question about simple binding:
(please forgive any syntax errors... I am at home, where I do not have
Vb.Net installed, and I rely far too much on Vb's intellisense!)
If I have two...
|
by: Rourke Eleven |
last post by:
I have looked and searched. What good is the databind property on
Radiobuttons? How does one go about actually using it? What is a good
resource on this? I understand that I can easily get/set...
|
by: Simon Verona |
last post by:
I'm not sure if I'm going down the correct route...
I have a class which exposes a number of properties of an object (in this
case the object represents a customer). Can I then use this...
|
by: Larry Serflaten |
last post by:
I am not sure how many are aware of this sort of data binding,
but as it is new to many (classic) VB developers I thought I
would post this once just to let people know of its availablility.
...
|
by: David Fúnez |
last post by:
Hi;
I'm working with Component One FlexGrid DataGrid, i've added a calculated
field to the DataGrid, when i press the Save Button an error
message is displayed "Cannot Change read Only...
|
by: johnb41 |
last post by:
I have a simple form with textboxes displaying records from a dataset.
To Add a record, i simply do this (successfully):
' bmb variable holds the me.bindingcontext(dataset, "table"), which...
|
by: Marina |
last post by:
Hi,
I have a text control bound to a column that is of type Decimal. I am doing
the validation myself to see if the user typed in something invalid, calling
CancelCurrentEdit and cancelling the...
|
by: Mikus Sleiners |
last post by:
Is there any way to enable exception throws in VS 2005, that occur during
binding operations?
I am upset that i can't see exceptions that are thrown during binding
operations. It's very hard to...
|
by: Steve K |
last post by:
First problem:
I am specifying a format string for a Binding object like so:
<code>
Binding binding = new Binding("Text",
item.EOBRemittance,
"AmountAllowed",
true,
DataSourceUpdateMode.Never,...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
| |