-
Calulated fields changes control values back to original
I am having major issues with databinding of row data returned via SQL Server
2000 to user controls. As background, I'm binding controls via the designer
to strongely-typed datasets.
Example 1 - Calulated fields changes control values back to original values
I have a data row which is bound to various controls (textboxes, comboboxes,
etc.). One control is a bound combobox which has a calulation routine fired
on the leave event. If I change the combobox (i.e combobox.valueselected)
and in the calculation routine update a calculated value in the same row,
the combox.valueselected goes back to the original value!?
Dim dr As DataRow = Me.myDateset.myTable.Rows(Me.BindingContext(Me.myDataset,
"myTable").Position)
dr("calculatedCost") = totpc <--this causes combobox to change back to
original value?
Me.txtCalcCost.Text = totpc.ToString
If I don't update row manually and just update bound cost box with just
Me.txtCalcCost.Text = totpc.ToString
The calculated cost in the row is not updated and thus not saved! What makes
this worse is that it is very inconsistant. Sometimes this seems to work
sometimes not. Is there a rule about changing bound row data? I am also wondering
if this behavior is event related. I've noticed other problems trying to
format control values on Leave and Enter events. So I've used GotFocus and
LostFocus events instead.
Any ideas or suggestions appreciated! I have other examples and will put
them up for discussion when I get I chance.
Thanks!!
-
Re: Calulated fields changes control values back to original
Jeff,
There are some problems with binding related to underlying exceptions. Catch
all exceptions in the CLR and see if anything pops up.
If not, are you using a view? If so, if you reset the view to the underlying
table, does it change anything?
Kathleen
"Jeff" <jeff@asifalcon.com> wrote in message news:3d7cf01d$1@10.1.10.29...
>
> I am having major issues with databinding of row data returned via SQL
Server
> 2000 to user controls. As background, I'm binding controls via the
designer
> to strongely-typed datasets.
>
> Example 1 - Calulated fields changes control values back to original
values
>
> I have a data row which is bound to various controls (textboxes,
comboboxes,
> etc.). One control is a bound combobox which has a calulation routine
fired
> on the leave event. If I change the combobox (i.e combobox.valueselected)
> and in the calculation routine update a calculated value in the same row,
> the combox.valueselected goes back to the original value!?
>
> Dim dr As DataRow =
Me.myDateset.myTable.Rows(Me.BindingContext(Me.myDataset,
> "myTable").Position)
> dr("calculatedCost") = totpc <--this causes combobox to change back to
> original value?
> Me.txtCalcCost.Text = totpc.ToString
>
> If I don't update row manually and just update bound cost box with just
>
> Me.txtCalcCost.Text = totpc.ToString
>
> The calculated cost in the row is not updated and thus not saved! What
makes
> this worse is that it is very inconsistant. Sometimes this seems to work
> sometimes not. Is there a rule about changing bound row data? I am also
wondering
> if this behavior is event related. I've noticed other problems trying to
> format control values on Leave and Enter events. So I've used GotFocus and
> LostFocus events instead.
>
> Any ideas or suggestions appreciated! I have other examples and will put
> them up for discussion when I get I chance.
>
> Thanks!!
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks