Re: databinding problem
- From: "RobinS" <RobinS@xxxxxxxxxxxxxxx>
- Date: Thu, 1 Feb 2007 01:21:40 -0800
Did you *try* the BindingSource? Because if you use one, and update the
underlying data source, the changes will be reflected on the bound
controls.
I've never used the Binding Manager; I always use a BindingSource because
it's to nifty. Give it a try, and let me know if it works.
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcom> wrote in message
news:IZSdnbgssJIMwSLYnZ2dnUVZ_u2mnZ2d@xxxxxxxxxxxxxxx
Robin,
I'm using Column_Changing mostly to validate input.
In this case, Column_Changing should change different column depending on
current column's value.
I know about BindingSource and I'm using BindingManager but that's on
form level.
I didn't find a way to force databinding update from a datatable except
as a workaround with raising Event as described.
Also, I do use n-tier model but Business and Data tier is contained in
one layer (Datasets/Datatable). All the validation/ updating datasource
happens here. This is acceptable scenario for us as we don't anticipate
having database source other than MSSQL and don't have problem with
BusinessObjects and DataLayer not being loosely coupled.
Again, the only problem is how to force Databinding, EndCurrentEdit from
Datatable.
"RobinS" <RobinS@xxxxxxxxxxxxxxx> wrote in message
news:FradnVkz7p5gCSPYnZ2dnUVZ_ruknZ2d@xxxxxxxxxxxxxx
Why are you using the Column_Changing events? Just a masochist? In my
experience, events never work the way you think they should in .Net, or
in the order you think they should.
Anyway, if I understand what you're doing, you're changing the data
source and the change is not reflected in the data displayed in the
controls on the screen that are bound to that data source.
Have you checked out the BindingSource? It is an intermediary between
your controls and your data source, and immediately reflects any changes
made to the data source in the controls. To push it the other way, you
invoke EndEdit. Then of course, you have to call Update on your adapter
to push the changes down to the data source.
So you add a Binding Source (add the component to your form from the
Data toolbox).
Set the data source of it to your data table.
myBindingSource.DataSource = myDataTable
Then bind your controls to the BindingSource.
myTextBox.DataBindings.Add(new Binding("Text", _
myBindingSource, "CompanyName", true))
myGrid.DataSource = myBindingSource
See if that gets you anywhere. And answer my question at the top; maybe
I can recommend another solution.
I use the n-layer model, so all of the data I display on the screen is
defined in Classes. I capture changes to them when the Property value is
modified.
Robin S.
-------------------------------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcom> wrote in message
news:kaidnc0JGflb7CPYnZ2dnUVZ_ualnZ2d@xxxxxxxxxxxxxxx
Still need an answer.
I made a workaround by creating an event under datatable and form
subscribes to it and calls BindingManager.EndCurrentEdit but would like
to know if there's another way.
Thanks,
Vlado
"RobinS" <RobinS@xxxxxxxxxxxxxxx> wrote in message
news:eOqdnQGuUNt2eibYnZ2dnUVZ_vKunZ2d@xxxxxxxxxxxxxx
Did you figure out the answer to this, or are you still hanging?
Because I have a pretty good idea, if you still need an answer...
Robin S.
---------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcom> wrote in message
news:rpGdnY53H6YTjSfYnZ2dnUVZ_qunnZ2d@xxxxxxxxxxxxxxx
VB.Net 2005 and Datatable/TableAdapter.
"RobinS" <RobinS@xxxxxxxxxxxxxxx> wrote in message
news:9aWdnXsb8c_UoiTYnZ2dnUVZ_uuqnZ2d@xxxxxxxxxxxxxx
Which version of .Net are you using? 2003 or 2005?
Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcom> wrote in message
news:4LudnUybUJhDdiXYnZ2dnUVZ_uWlnZ2d@xxxxxxxxxxxxxxx
Hello,
I'm using typed dataset for databinding to windows controls and I'm
having some problems.
I'm trying to move all business logic to datatable column_changing
events and the problem that I'm having is when I change some other
column, control value doesn't update immediately until I call
endcurrentedit on bindingmanager which doesnt happen until user
click update button.
Here's my problem:
Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
Handles Me.ColumnChanging
Select Case e.Column.ColumnName
Case Me.dbaColumn.ColumnName
Me(0).categoryID = "changed_column"
End Select
End Sub
Now, unerlying dataset.datatable(0).categoryID is indeed changed
but databound textbox control remains the same.
How can I force databinding.update from dataset/datatable?
Thanks,
Vlado
.
- Prev by Date: Re: I now understand Aaron Kempf (WAS: WHERE CAN I ASK A QUESTION ABOUT VB?)
- Next by Date: Re: Need Your Opinion!
- Previous by thread: RE: Help with a DataGridView
- Next by thread: Re: Need Your Opinion!
- Index(es):
Relevant Pages
|