DataSet.Clear

J

jaro

Hi
I've simple scenario. I've win form with text edit bound to my dataset
object. this dataset has one table with one column (datasource for my edit).
Everything works fine, but when I clear my Dataset anf fill it again (from
web service) my text edit lose binding (doesn't display valid value).
I know that I should call SusspendBinding and ResumeBinding but what is
realy happend?
Why it doesn't work without these two methods?

Thanks

Shark
 
M

Marina Levit [MVP]

What I think is happening is that when you clear the data, the 'current row'
for the binding becomes 'no row', since there are no rows. When you get data
again, the current row for the binding is not changed to be the first row -
try doing this yourself.
 
J

jaro

Thanks, what I noticed is that Binding object connected with my edit is
being "not active" after clear operation (it's IsActive property is set to
false). Why?

Shark
 
R

RobinS

Are you using .Net 2.0?

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
 
R

RobinS

The easiest thing to do is add a BindingSource to your form.

Bind the BindingSource to your DataSource, and then bind the controls to
the binding source.

Whenever the data source attached to the binding source gets updated, the
binding source handles the update of the controls automatically and
immediately.

So when you clear your dataset, the screen will react immediately.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
----------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top