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

Update bound windows control

P: n/a
I have a windows form that is bound to a datatable. In VB6
I could just update the field contents and it would be
updated in the database, however if I update the text
property of the control from code it is 50% chance that
the update will make it back to the dataset. If I update
the dataset instead of the form, it does not show on the
form.

Is there a method that should be used?

Thanks
Paul
Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Paul,

Thanks for posting to the newsgroup.

When you say you have a windows form that is bound to a datatable, what do
you mean? What type of data binding are you using to bind a table to the
form itself?

Thanks for clarifying,
bliz
--
Jim Blizzard, MCSD .NET
Community Developer Evangelist | http://www.microsoft.com/communities
Microsoft

Your Potential. Our Passion.

This posting is provided as is, without warranty, and confers no rights.

"PAUL EDWARDS" <an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
I have a windows form that is bound to a datatable. In VB6
I could just update the field contents and it would be
updated in the database, however if I update the text
property of the control from code it is 50% chance that
the update will make it back to the dataset. If I update
the dataset instead of the form, it does not show on the
form.

Is there a method that should be used?

Thanks
Paul

Jul 21 '05 #2

P: n/a
Sorry it's not the form, it's most controls on the form
that are bound to columns in one of the tables in a
dataset.

The databindings.text property for the control
txtSalePrice is set to dsetContract (contract dataset) -
tblContract (contract table) - SalePrice (sale price
column in contact table).

According to an entry in another control I wish to set the
value in the Sale Price control. I also wish to create a
default set of comments to store with the sale depending
on values in several controls.

Hope that's clear.
Thanks
Paul
-----Original Message-----
Hi Paul,

Thanks for posting to the newsgroup.

When you say you have a windows form that is bound to a datatable, what doyou mean? What type of data binding are you using to bind a table to theform itself?

Thanks for clarifying,
bliz
--
Jim Blizzard, MCSD .NET
Community Developer Evangelist | http://www.microsoft.com/communitiesMicrosoft

Your Potential. Our Passion.

This posting is provided as is, without warranty, and confers no rights.
"PAUL EDWARDS" <an*******@discussions.microsoft.com> wrote in messagenews:07****************************@phx.gbl...
I have a windows form that is bound to a datatable. In VB6 I could just update the field contents and it would be
updated in the database, however if I update the text
property of the control from code it is 50% chance that
the update will make it back to the dataset. If I update
the dataset instead of the form, it does not show on the
form.

Is there a method that should be used?

Thanks
Paul

.

Jul 21 '05 #3

P: n/a
Yes, that helps quite a bit.

Are you sure there's only one record in the dataset? The DataBinding allows
you to bind a list of records to a control that doesn't display multiple
records. Perhaps you're working with a different record in the dataset?

Also, make sure the change is making it back into the dataset itself. Once
the dataset is changed, the bound controls should display the new value
(assuming the control is "pointing to" the record that's been updated).
Perhaps you could set a breakpoint and view the contents of the dataset
after you've changed the data on the screen.

If you're making changes to a textbox and want to update the underlying
dataset it's bound to, you'll have to do that in code, perhaps in a button
click event.

I created a simple test program with a couple of textboxes and a datagrid.
I DataBound the textboxes and the dataGrid to the same dataset. (Used this
approach because I knew a datagrid would update the dataset when I made a
change.) As long as I updated the first record, the changes were
automatically reflected in the textboxes.

Hope this helps,
bliz

--
Jim Blizzard, MCSD .NET
Community Developer Evangelist | http://www.microsoft.com/communities
Microsoft

Your Potential. Our Passion.

This posting is provided as is, without warranty, and confers no rights.

"Paul Edwards" <pa**@nospam.go-dcl.co.uk> wrote in message
news:09****************************@phx.gbl...
Sorry it's not the form, it's most controls on the form
that are bound to columns in one of the tables in a
dataset.

The databindings.text property for the control
txtSalePrice is set to dsetContract (contract dataset) -
tblContract (contract table) - SalePrice (sale price
column in contact table).

According to an entry in another control I wish to set the
value in the Sale Price control. I also wish to create a
default set of comments to store with the sale depending
on values in several controls.

Hope that's clear.
Thanks
Paul
-----Original Message-----
Hi Paul,

Thanks for posting to the newsgroup.

When you say you have a windows form that is bound to a

datatable, what do
you mean? What type of data binding are you using to

bind a table to the
form itself?

Thanks for clarifying,
bliz
--
Jim Blizzard, MCSD .NET
Community Developer Evangelist |

http://www.microsoft.com/communities
Microsoft

Your Potential. Our Passion.

This posting is provided as is, without warranty, and

confers no rights.

"PAUL EDWARDS" <an*******@discussions.microsoft.com>

wrote in message
news:07****************************@phx.gbl...
I have a windows form that is bound to a datatable. In VB6 I could just update the field contents and it would be
updated in the database, however if I update the text
property of the control from code it is 50% chance that
the update will make it back to the dataset. If I update
the dataset instead of the form, it does not show on the
form.

Is there a method that should be used?

Thanks
Paul

.


Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.