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

databinding problem

P: n/a
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
Jan 25 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.com ...
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


Jan 25 '07 #2

P: n/a
VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.com. ..
Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.com ...
>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



Jan 26 '07 #3

P: n/a
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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.com ...
VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.com. ..
>Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.co m...
>>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




Jan 28 '07 #4

P: n/a
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" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.com. ..
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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.com ...
>VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.com ...
>>Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.c om...
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




Jan 29 '07 #5

P: n/a
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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:ka******************************@giganews.com ...
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" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.com. ..
>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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.co m...
>>VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.co m...
Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews. com...
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
>
>




Jan 30 '07 #6

P: n/a
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" <Ro****@NoSpam.yah.nonewrote in message
news:Fr******************************@comcast.com. ..
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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:ka******************************@giganews.com ...
>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" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.com ...
>>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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.c om...
VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.c om...
Which version of .Net are you using? 2003 or 2005?
>
Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews .com...
>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
>>
>>
>
>




Jan 30 '07 #7

P: n/a
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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:IZ******************************@giganews.com ...
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" <Ro****@NoSpam.yah.nonewrote in message
news:Fr******************************@comcast.com. ..
>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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:ka******************************@giganews.co m...
>>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" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.co m...
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" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews. com...
VB.Net 2005 and Datatable/TableAdapter.
>
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast. com...
>Which version of .Net are you using? 2003 or 2005?
>>
>Robin S.
>------------------------
>"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
>news:4L******************************@giganew s.com...
>>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
>>>
>>>
>>
>>
>
>




Feb 1 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.